Meaning behind underscore character in regular expressions

前端 未结 1 1187
渐次进展
渐次进展 2021-01-24 03:45

Note: My program works, I am just looking for an explanation as to why.

I have a java program that reads a file, counts the words in said file, and outp

相关标签:
1条回答
  • 2021-01-24 04:09

    There's nothing special about an underscore in a regular expression, it's just a normal character like A. A hyphen at the end of a character class isn't special either, although it is when between two other characters, as you've used it to match all letters by saying A-Z for example.

    Regular expressions are similar between most languages, but some of the more esoteric features can be different or missing from a language.

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