Regex: Replace after I between tags

  • I have this title, translated in Belarusian.

    <title>Divano | Я хачу паставіць</title>
    <title>America | ў пачатку радка</title>
    <title>America | сёння яны едуць у амерыку</title>

    I want to become:

    <title>Divano | My name (en)</title>
    <title>America | My name (en)</title>
    <title>America | My name (en)</title>

    This is the solution, maybe someone need it:

    Search: <title>.*\|\K(.*)(</title>)
    Replace by: \x20My name (en)\x20\2

  • Probably we don’t need postings of random regex replacement solutions.

  • Plus, it doesn’t work like you say anyway. :-(

    If you use literal ( or ) in your replace expression, you must escape them as \(, \) or they do not appear!

Log in to reply