Perl Regular expression | how to exclude words from a file

后端 未结 5 1679
夕颜
夕颜 2021-01-21 17:47

i searching to find some Perl Regular Expression Syntax about some requirements i have in a project. First i want to exclude strings from a txt file (dictionary).

For ex

5条回答
  •  感动是毒
    2021-01-21 18:25

    My problem is that i have 2 regex that working:

    Not allow over 3 pairs of chars:

              (?=^(?!(?:\w*(.)\1){3}).+$)
    

    Not allow over 4 times a char to repeat:

            (?=^(?:(.)(?!(?:.*?\1){4}))*$)
    

    Now i want to combine them into one row like:

          (?=^(?!(?:\w*(.)\1){3}).+$)(?=^(?:(.)(?!(?:.*?\1){4}))*$)
    

    but its working only the regex that is first and not both of them

提交回复
热议问题