mardi 27 décembre 2016

How do i use RegEx to find a string at the end of a line after a given pattern

Goal is: to remove everything that is not a NAME or ID from a text.

Paula Abdul @PaulaAbdul Dec 25 18:13:07 +0000 (GMT) via XYZ Web Client
( ... Some junk line to remove ... )
Michael Jackson @MichaelJackson Dec 27 16:03:01 +0000 (GMT) via XYZ Web Client
( ... Other stuff to remove / e.g. an empty line)
George Michael @GeorgeMichael Dec 28 19:23:15 +0000 (GMT) via XYZ Web Client

  1. Select all lines that do not contain "@SomeString"
  2. OR select everything after "@SomeString" to the line end

Example:

Pattern: "@PaulaAbdul"
Result: Dec 27 18:13:07 +0000 (GMT) via XYZ Web Client

So far i know:

Ignore all Lines with <string>:  ^((?!@<string>).)*$

and how can i combine both searches into one?

i assume: <pattern1>|<pattern2>

I am using https://atom.io Editor for my RegExp search.




Aucun commentaire:

Enregistrer un commentaire