Skip to main content
Participating Frequently
June 11, 2022

Why does Dreamweaver regex replace some word into a wrong word?

  • June 11, 2022
  • 1 reply
  • 156 views

Why does Dreamweaver regex replace some word into a wrong word?

-----------------------

In short:

1. if you use a regex pattern contains an `or` syntax, `|`, eg:

(( and )|( that ))

2. and your replacement contains a capture group `$1`, eg:

$1foobar

3. and you perform an regex replace all in Dreamweaver 

some text could be replaced with the wrong String, due to the `|` in the regex pattern. eg:

AA and BB

it should be replaced into

AA and foobarBB

but it may be replaced into 

AA that foobarBB

which is wrong.

-----------------------

I had the exact same issue as what this web link describes (I reformated the simplified example from that link to above)

https://superuser.com/questions/1725719/dreamweaver-regex-replace-into-a-wrong-character-how-to-avoid 

(For more detials, please view that link, it has better description and image.)

-----------------------

I am using Dreamweaver 2021 (Version 21.2) 

OS Windows 10

-----------------------

(If someone test it, and you can / cannot reproduce the issue, please let me know. 

And please let me know what version of Dreamweaver you are using that doesn't have such issue.)

1 reply

Participating Frequently
June 17, 2022

There is an update: