Log in

View Full Version : Need help creating regex to change italic markings


Firestorm
4th September 2022, 05:32
Hi all,

I'm hoping more experienced users can help me out.

I'm trying to create a regex that will alter all italic markings to go from something like this:

<i>JOHN: Thanks.</i>

to

JOHN: <i>Thanks.</i>

Nikse555
4th September 2022, 07:59
Something like this?

https://www.nikse.dk/regex-italic.png

Firestorm
4th September 2022, 09:42
This works like a dream! Thank you so much.

When you mentioned it before, I thought you were starting me off with a partial pattern. Didn't realize you had given me the whole thing.

Could the following conditions be added to this rule or a new one if it's easier?


If there's a space/numeral after the first word eg., "<i>MAN 1:" or "<i>WOMAN ON PA:"
If there's a dialogue dash before the first word eg., "<i>-MAN 1:"

Also, how can I tweak the regex above to do the same thing but where there are brackets?

<i>[man 2] How are you today?</i>

to this:

[man 2] <i>How are you today?</i>

Something like this?

(<i>)(\[[A-Z \d]\]) replace: $2 <i>