Click to See Complete Forum and Search --> : Regular Expression


Bernhard Dreyer
May 31st, 1999, 06:43 AM
Maybe someone can help me with regular expressions. I have read the articles posted
here at codeguru, but I still can't understand them.

Can someone please translate the following search strings in regex:
world && USA
world || USA
world && !USA

I think with these examples I might understand regular expressions (hopefully).

Thanx in advance

BARNIE

ChrisD
June 1st, 1999, 01:09 PM
I assumed you want a regular expression to match any of the three examples provided.

world[ \t]+[(&&)|(\|\|))[ \t]+!*USA

world (find world)
[ \t]+ (find one or more spaces and or tabs)
[(&&)|(\|\|)] find && or ||
[ \t]+ (find one or more spaces and or tabs)
!* (find 0 or more !) (some regex support ? which means 0 or 1 of previous expression VC 5 does not)
USA (find USA)

HTH,
Chris