I have these flex rules:
^User-Agent: [^\n]*Firefox {useragent = TFIREFOX; }
^User-Agent: [^\n]*MSIE {useragent = TMSIE; }
^User-Agent: [^\n]*Opera {useragent = TOPERA; }
^User-Agent: [^\n]*Safari {guseragent = TSAFARI; }
...
I get warnings: rule cannot be matched on all lines after the first rule. I expect the first rule to match just lines, with “Firefox” in them but I think Im wrong. How to repair these rules? I read flex manpage and I’m still helpless.
I believe the issue here is that flex uses spaces to delimit tokens for regex matching. So when it parses your file it is treating everything after “^User-Agent:” as part of the action. You can make this work by escaping the space:
I tested with flex 2.5.35, will do what you want.