regex - Rexex Everything after the "." but ignore "|" -


i have 2 variations of text string:

10.09.2016 | 45 min. | swr fernsehen | ut 

or

07.09.2016 | 57 min. wdr fernsehen 

i looking end with:

swr fernsehen | ut  

and

wdr fernsehen 

this have tried capturing group:

\\.\s(.*) 

this returns:

| swr fernsehen | ut wdr fernsehen 

i cant work out how " take after "." ignore "|"

any ideas?

you may use following regular expression:

.*\.(?:\s*\|)?\s*(.*) 

see regex demo

the .*\. match , including last . (because * greedy quantifier), (?:\s*\|)? match 1 or 0 sequences of 0+ whitespaces + |, \s* - 0 or more whitespaces , (.*) grab rest group 1, access group contents tool/language features.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -