0

Hello!

Trying to use regexp in glib but I cannot get it to work. I would like to have a regular expression to describe:
[2003-03-11 13:14:12.111] letters letters.:1234 Hello

I have tryed the following expression in 'regular expression testers' and there this works:
^\[\d{4}\-\d{2}\-\d{2}\s\d{2}\:\d{2}\:\d{2}\.\d{3}\]\s\w*\s*\w*\.+\w*\:\d{4}\sHello

But not with glib's regexp. Why is that?:X

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by LindaWiklund
0

Could it be that you have not escaped backslashes in your string?
I.e. in your code the string should be:

const char regex[] = "^\\[\\d{4}\\-\\d{2}\\-\\d{2}\\s\\d{2}\\:\\d{2}\\:\\d{2}\\.\\d{3}\\]\\s\\w*\\s*\\w*\\.+\\w*\\:\\d{4}\\sHello"
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.