This regular expression pattern should be easy 
Author Message
 This regular expression pattern should be easy

I just need to get "lj455" and "lj4454" in the string below. What would be a
corret patrn ?

oString = "room 202 printer:lj455 printer:lj4454"
oPatrn = "(printer:*)" '===> It doesn't give the results I need. I just need
to get the word that preceeds "Printer:" up to a blank space.

RegExpTest oPatrnO,oStrngO

Function RegExpTest(patrn, strng)

Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True

Set Matches = regEx.Execute(strng)
For Each Match in Matches
    WScript.echo Match
Next
End Function



Sat, 10 Jul 2004 01:52:11 GMT  
 This regular expression pattern should be easy
Solved.
regEx.Pattern = "printer:(\S+)"


Quote:
> I just need to get "lj455" and "lj4454" in the string below. What would be
a
> corret patrn ?

> oString = "room 202 printer:lj455 printer:lj4454"
> oPatrn = "(printer:*)" '===> It doesn't give the results I need. I just
need
> to get the word that preceeds "Printer:" up to a blank space.

> RegExpTest oPatrnO,oStrngO

> Function RegExpTest(patrn, strng)

> Set regEx = New RegExp
> regEx.Pattern = patrn
> regEx.IgnoreCase = True
> regEx.Global = True

> Set Matches = regEx.Execute(strng)
> For Each Match in Matches
>     WScript.echo Match
> Next
> End Function



Sat, 10 Jul 2004 02:08:10 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Regular expression - It should be easy, but I am having a bad time

2. Regular expressions and/or pattern matching in VBA?

3. Regular Expressions to Match a Pattern

4. Regular Expressions Repace Pattern

5. Regular Expression Pattern Problem

6. needed: regular expression pattern

7. needed: regular expression pattern...

8. regular expression pattern

9. Regular Expression Pattern with Smart Quotes

10. Repetitive pattern devided by space in regular expression

11. HELP - adv. regular expression - pattern

12. Regular Expression, ORing the patterns.

 

 
Powered by phpBB® Forum Software