I want to replace only first occurrence of word(default) in each line with another word(rwd).
As below I want this:
../app/design/adminhtml/default/default/layout/pmodule.xml
../app/design/frontend/default/default/layout/pmodule.xml
../app/design/frontend/default/default/template/company/module/gmap.phtml
To be replaced to this:
../app/design/adminhtml/rwd/default/layout/pmodule.xml
../app/design/frontend/rwd/default/layout/pmodule.xml
../app/design/frontend/rwd/default/template/company/module/gmap.phtml
I have tried \bdefault\b
but in vain.
You can use a regex with a lazy dot matching pattern:
^(.*?)\bdefault\b
To replace with \1rwd
.
See the regex demo
Pattern details:
^
- start of line/string(.*?)
- Group 1 capturing any 0+ characters other than a newline as few as possible up to the first\bdefault\b
- whole word default
.GEdit screenshot:
Geany screenshot:
You can search using this lookahead regex:
^((?:(?!\bdefault\b).)*)default
And replace it using:
\1rwd
RegEx Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With