Can regular expressions work with different languages?

后端 未结 8 1485
慢半拍i
慢半拍i 2020-12-10 05:42

English, of course, is a no-brainer for regex because that\'s what it was originally developed in/for:

Can regular expressions understand this charact

8条回答
  •  不思量自难忘°
    2020-12-10 06:15

    "[\p{L}]" This regular expression contains all characters that are letters, from all languages, upper and lower case. so letters like (a-z A-Z ä ß è 正 の文字を理解) are accepted but signs like (, . ? > :) or other similar ones are not.

    • the brackets [] mean that this expression is a set.
    • If you want unlimited number of letters from this set to be accepted, use an astrix * after the brackets, like this: "[\p{L}]*"
    • it is always important to make sure you take care of white space in your regex. since your evaluation might fail because of white space.

提交回复
热议问题