Noobish RegExp question with ^

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
KalleL
Forum Newbie
Posts: 12
Joined: Mon Apr 30, 2007 8:52 am

Noobish RegExp question with ^

Post by KalleL »

Hello,

I'm sorry, this is really a stupid question. I've tried to look regex tutorials to solve this one, but no luck.

So I've played with a script that queries gameserver (Enemy Territory: Quake Wars) and echos server status, players etc. But now server name and players are having color codes in their names. Color codes are like ^1,^2,^3 ... ^9 and ^a to ^z. So basicly I would need to parse these off the string: like this: ^[1-9a-z] or something like that.

Anyone to help this little newbie? :oops:
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

^ symbol is a special symbol - it means "the begining of the line". Thus, you need to escape it like this: \^ in your regexp.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply