Replace what's within X and X - list. Help needed.



  • Hello okey this is what i need help with!

    How do i replace for example:

    [Object] Randomtext xxxx blablabla [/object]
    [Object] Randomtext yyyy blablabla [/object]

    The only thing i want to change is the TEXT inside the [object] but with a list.
    Etc a other list that have it like this:
    Emma
    Dave

    It should be added and replaced with the
    [Object] Randomtext xxxx blablabla [/object]
    [Object] Randomtext yyyy blablabla [/object]
    But only that xxxx becomes Emma and the yyyy becomes Dave.

    Thanks in advance!



  • Replace using a regex. Something like:
    replace \([Object]\sRandomtext\s)(xxxx)(.*?)([/object]) with $1Emma$3
    and replace \([Object]\sRandomtext\s)(yyyy)(.*?)([/object]) with $1Dave$3$4



  • Hello Jessica,

    I suppose that the values Emma and Dave are part of a list of first names, aren’t they ?

    Therefore, it would be interesting to extend this S/R regex to any number of first names, that are to be replaced !

    So, could you tell us how you detect the xxxx and yyyy strings, inside a block [object]....[/object] and could you provide an short example of your text, to illustrate the changes that are needed ? Thanks !

    Best Regards,

    guy038


Log in to reply