[thelist] RegEx Fun

Seth Bienek seth at sethbienek.com
Fri Jan 4 18:40:21 CST 2002


> ok, precisely where in the regex does it allow characters in between the
> and the name/value delimiting character (& or [:space:])?  or does
> "[^[&|[:space:]]" mean anything that's "NOT & or [:space:]"?  nevermind, i
> think i figured it out myself.

n means "Get the first N"
[^n] means "Get the first thing that isn't an n"
[^n]* means "Keep going until you hit an n"
[^[n|o|p]]* means "Keep going until you hit an n, o, or p"

[[:space:]] means "A space-type character"
[^[:space]] means "NOT a space-type character"
[[:alnum:]*] means "Keep going until you hit something that isn't

<tip type="ColdFusion Regular Expressions">
The POSIX classes are covered in the CF documentation, but what isn't
documented is how to use ascii character values, which is important if you
are ever going to be working with line breaks:
[^[:cntrl:]13]* means "Keep going until the end of the line"

RegExps are a pain in the ass to figure out, but it's one of those things
that just "clicks" all of a sudden, and leaves you thinking, "How did I ever
get along without this?"

> function URLReplace(string, substring1, substring2)




More information about the thelist mailing list