Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Very interesting issue with regular expression Please Help Me :)
#2
Not Solved
Hi,

try this code:
Code:
Dim strStr

strStr = "37596 AndrzejCzwarty ldskajf@porirker\.plUnlocked2012-11-30 37568 AndrzejDrugi ksjhgjhsdgfui@woeijf\.plLocked2012-11-30 37554 AndrzejPierwszy" &_
              " kdjsfhsjd@sdklj\.plLocked2012-11-30 37582 AndrzejTrzeci lsdhflkadjhf@lsdkf\.plUnlocked2012-11-30 " & _
              "ZdenekSmetana ldskajf@porirker\.p Locked 88888 " & _
              "Jan Kowalski ldskajf@porirker\.p Locked " & _
               "Jan Nowak ldskajf@porirker\.p Locked 2012-11-30 "

Dim oRegx
Dim oMatches
Set oRegx = new  RegExp  

oRegx.pattern = "Locked(\d{4}-\d{2}-\d{2})*\s\d+\s"
oRegx.Global = true

Set oMatches = oRegx.Execute(strStr)

   For Each Match in oMatches   ' Iterate Matches collection.
      strValue =   Match.Value
      strValue1 = Mid( strValue, inStr( strValue, " " ) + 1 )
      MsgBox strValue & " =====> " & strValue1
   Next
This code assumes that the number that has to be extracted from data is always surrounded by two spaces, that is:
-exactly one space before the number, and exactly one space after the number.
Reply


Messages In This Thread
RE: Very interesting issue with regular expression Please Help Me :) - by kordirko - 12-03-2012, 05:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,990 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,724 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 4,317 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 17,006 12-08-2014, 06:38 PM
Last Post: anshika.agarwal
  need a regular expression. anu05446 0 3,408 11-26-2014, 03:00 PM
Last Post: anu05446

Forum Jump:


Users browsing this thread: 1 Guest(s)