Raj
Raj

Reputation: 81

Creating a regular expression to match words of varying lengths

I'm writing a regular expression to parse a logfile and I'm having trouble figuring out how to establish a range(?) of sorts for a particular expression. In this case specifically, my logfile contains various severities:

(['EMERG','ALERT','CRIT','ERR','WARNING','NOTICE','INFO','DEBUG'])

I'm basically wondering how I'd write regular expression to match all of those. I understand most digit work, but characters are posing difficult issues for me.

Upvotes: 0

Views: 63

Answers (1)

this regex will match all these entries: [A-Za-z]{1,} basically it says match all patterns that have only chars from A to Z or a to z with the lenght of at least one char.



for more information see this: regex cheat-sheet



and try your regex here: http://gskinner.com/RegExr/

Upvotes: 1

Related Questions