Regex Pain

Since Regular Expressions give me headache, I’m writing this so that I remember what the hell things are.

^ = Start of line

$ = End of line

\s = space

\S = non space

| = or

* = 0 or more eg \s* = 0 or more spaces

+ = 1 or more eg \s+ = 1 or more spaces

. = anything eg .* = 0 or more anything

If you want to match something and give it a name is (?<name>…) where … is the regular expression

eg:Action: (?<action>\S+(\s\S+)*)\s+(User: (?<user>.*),.*)*\.\\(?<file>.+)
 

 

 

 

Advertisements

One thought on “Regex Pain

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s