RegEX Help
Posted: Wed May 13, 2009 6:18 pm
I have an array of lines.
ex:
02/05/2009,12:, [sbh\dekk44] Test [Who Boss] weeekddseee:
4/3/2003,12:, [ahell] Test [Who Boss] weeekddseee:
I need to draw out the string within the [ ] as long as they:
Currently, I have:
preg_match("#\[(\w+)\]#i", $line, $matches)
It correctly matches ahell, but I cannot figure out how to match the sbh\ or it's lack thereof.
Any help?
ex:
02/05/2009,12:, [sbh\dekk44] Test [Who Boss] weeekddseee:
4/3/2003,12:, [ahell] Test [Who Boss] weeekddseee:
I need to draw out the string within the [ ] as long as they:
- have sbh\ or no sbh\
have no white space within the [ ]
can be any length greater than 1
can contain any number of numbers or letters
Currently, I have:
preg_match("#\[(\w+)\]#i", $line, $matches)
It correctly matches ahell, but I cannot figure out how to match the sbh\ or it's lack thereof.
Any help?