Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help extended regex Sequence \w 2

Status
Not open for further replies.

ability1

Programmer
Dec 24, 2002
23
US
I know \w will match any "word" character (alphanumerics plus "_").

But what would match any "word" character EXCLUDING "_" (the underscore).

 
\w is a shortcut for the pattern class [_0-9a-zA-Z]. So just use the pattern class minus the "_".


$match =~ /[0-9a-zA-z]{3}/;

will match any three characters that are in the range given.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top