What is the regex to match xxx[any ascii char here, spaces included]+xxx?
I am trying xxx[(\w)(\W)(\s)]+xxx but it doesn't seem to work.
views:
70answers:
6
+3
A:
If you really mean any and ASCII (not e.g. all Unicode characters):
xxx[\x00-\x7F]+xxx
Matthew Flaschen
2010-07-08 11:52:09
+2
A:
Try using .+
instead of [(\w)(\W)(\s)]+
.
Note that this actually includes more than you need - ASCII only defines the first 128 characters.
Mark Byers
2010-07-08 11:53:14
A:
.
stands for any char, so you write your regex like this:
xxx.+xxx
Vitaly Polonetsky
2010-07-08 11:54:13
A:
Depending on what you mean with "ascii char" you could simply try
xxx.+xxx
RoToRa
2010-07-08 11:54:25
+4
A:
Since US-ASCII characters are in the byte range of 0x00–0x7F (0–127):
xxx[\x00-\x7F]+xxx
Gumbo
2010-07-08 11:55:02
.. if it is implemented
mykhal
2010-07-08 12:20:46