0

Looking to write some regex to match only the strings in the follow that don't contain a pipe.

4 Canciones: No. 2, Dices que no la quieres
5 Canciones canciones para niños: No. 1, Balada
Spanish; Castilian | es
Spanish; Castilian | es
El molinero
Spanish; Castilian | es

So far I've got

^(?!\|).+

But it simply matches the first string and stops after that.

Looking for all advice. Thanks!

Jake Handy
  • 11
  • 1
  • 3
  • 2
    `^[^|]+$` but this is a duplicate of http://stackoverflow.com/questions/4105956 – logi-kal May 04 '17 at 15:32
  • Possible duplicate of [Regex - Does not contain certain Characters](http://stackoverflow.com/questions/4105956/regex-does-not-contain-certain-characters) – logi-kal May 04 '17 at 15:32

1 Answers1

0

You can loop over each line and keep those that match. The regex

^(?!.*\|).+

should work for your examples.

Shaido
  • 27,497
  • 23
  • 70
  • 73