1

I have these lines :

example
example example
example example example
example example, example
example example example.
 example


example12
example example*
example example (example)
éxample example

I want to remove just this lines :

example12
example example*
example example (example)
éxample example

Like this :

enter image description here

Code 1 :

^(?![a-zA-Z,.']+$).+$\R?

Code 2 :

^.*[^a-zA-Z.,'].*$

Space between two words :

[ \t]+
moon93
  • 129
  • 3
  • 11
  • Could you explain your requirements in words? You want to remove any line that contains chars other than alphanumeric, comma, period and single quote chars, and.... please continue. Maybe just add `\h` to the character class - `^(?![a-zA-Z,.'\h]+$).+$\R?`? – Wiktor Stribiżew May 17 '17 at 11:31
  • Thank you Sir @WiktorStribiżew , Just i want to filter english text , :) it works fine ^^ – moon93 May 17 '17 at 11:44

1 Answers1

1

It seems all you need is to make sure a whitespace is also considered a valid char, add it to the lookahead in the first regex:

^(?![a-zA-Z,.'\h]+$).+$\R?

The \h is used instead of \s in order to prevent jumping to another line. \s matches line breaks, and \h only matches a horizontal whitespace. enter image description here

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563