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

cron - how to properly run Python script with crontab on every system startup -

elasticsearch - Is the order of operations guaranteed in a bulk update? -

Slow performance first queries on SQL Azure -