Abdullq Abdullq - 1 year ago 79
Java Question

How to match all the character after a word

I have this sentence "I am a boy with French - Glukker Man". I want to match every character after French so that the regex highlights " - Glukker Man". Currently I am using this: Currently I am doing:


But it's highlighting only "French".
This is the regex test

Please, how do I do it?

Answer Source

Use a positive lookbehind to match french, then select everything after it with .*:


Then you can use it in your replacement:


Alternatively, you could just match french and then only capture what comes after it.


In this case it looks like you're trying to surround your match with <center></center>, so for the second example to work, you'd have to capture french in its own group and put it back, or have it in your replacement:

Regex: (french)(.*)
Replacement: $1<center>$2</center>


Regex: french(.*)
Replacement: french<center>$1</center>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download