Question

So if I wanted to key in an Arrow character, -->, via JFlex's regex, I'd figure it would just be the string "-->". However, if I attempt this, I always get a Could not match Input error.

"-->"   {}

Doesn't work. Neither does a combination of escaping certain characters as far as I can tell. I know each of those characters is special in flex, and I know the /-->/ literal way that works in other languages wont in Java.

What am I missing?

Was it helpful?

Solution

If I understand correctly, you're trying to find a match for '-->'? If so, the expression [\-\-\>]+ fill find that match.

Tested at http://www.regexplanet.com/advanced/java/index.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top