Search code examples
regexxmlnotepad++prefixes

regular/notepad++ expressions


Basically, I'm struggling with extracting data and importing into a new field. Can this be done:

namewithprefix="PS4 | Call of Duty" namewithoutprefix=""

I want it to look like this

namewithprefix="PS4 | Call of Duty" namewithoutprefix="Call of Duty" 

Both on the same line in the xml document

Many thanks


Solution

  • Find:

    namewithprefix="(.+) \| (.+)" namewithoutprefix=""
    

    Replace:

    namewithprefix="$1 | $2" namewithoutprefix="$2"
    

    .+ will find any number of 1 or more characters, and anything in () is captured as a variable. The two variables are then used in the replace as $1 and $2.