How to define a Regex in StandardTokenParsers to identify path?

前端 未结 1 1426
一向
一向 2021-01-26 07:31

I am writing a parser in which I want to parse arithmetic expressions like: /hdfs://xxx.xx.xx.x:xxxx/path1/file1.jpg+1 I want to parse it change the infix to postfix and do the

相关标签:
1条回答
  • 2021-01-26 08:14

    In a double quoted string backslash is an escape character. If you mean to use the literal backslash in a double quotes string you must escape it, thus "\d" should be "\\d".

    Furthermore you do not need to escape the regex dot within a character class, since dot has no special meaning with a character class. So "[\d.]" should just be "[\d.]".

    You can also forgo all this escaping business by using the raw interpolator or multi-line string literals using triple quotes.

    0 讨论(0)
提交回复
热议问题