2

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?

Skyl3lazer
  • 368
  • 2
  • 10
  • Could you show us your current code, along with your exact input on which you're trying to test this regex? – everton Feb 17 '14 at 21:55
  • 'A --> a B' was input, and the rule was as shown, using JFlex. The problem I believe was that I wasn't taking into account the white space in the input, and thought it was taking a word at a time. – Skyl3lazer Feb 18 '14 at 23:17
  • Sorry, I still do not understand what do you want to accomplish here. – everton Feb 21 '14 at 14:06

1 Answers1

1

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

Nicholas
  • 98
  • 1
  • 1
  • 9