Another good application-Regular Expression to find replacement strings
Last Update:2018-12-08
Source: Internet
Author: User
The following code is taken from the source code of a webpage:
OnClick = "MM_openBrWindow ('../photo/nlife/sfc/pages/o'connors_jpg.htm', 'rd', 'width = 456, height = 100 ')"
OnClick = "MM_openBrWindow ('../photo/nlife/sfc/pages/Trad 'r sam_jpg.htm', 'rd', 'width = 456, height = 100 ')"
OnClick = "MM_openBrWindow ('../photo/nlife/sea/pages/Mondo's Beach pub_jpg.htm', 'rd', 'width = 456, height = 100 ')"
OnClick = "MM_openBrWindow ('.. /photo/nlife/tam/pages/Mirage (Moet's) _jpg.htm ', 'RD', 'width = 456, height = 368 ')"
OnClick = "MM_openBrWindow ('.. /photo/nlife/tem/pages/Macayo's-N Central_jpg.htm ', 'RD', 'width = 456, height = 368 ') ">
OnClick = "MM_openBrWindow ('../photo/nlife/tem/pages/RT o'sullivans_jpg.htm', 'rd', 'width = 456, height = 100 ')"
OnClick = "MM_openBrWindow ('.. /photo/nlife/nyc/pages/Pat O 'Hurley's Bar & grill_jpg.htm', 'RD ', 'width = 456, height = 368 ')"
Here, you need to replace 'batch with '\ In the link. Note that there are spaces, special characters (horizontal bars, Parentheses, and &) in the Link. In some cases,' appears more than once. During the replacement process, you cannot replace 'from other places or other content in the link. I want to replace it with a DW regular expression. How can I write such a regular expression? <Textarea id = "txtSrc" rows = "15" cols = "80"> <br/> onClick = "MM_openBrWindow ('.. /photo/nlife/sfc/pages/o'connors_jpg.htm', 'rd', 'width = 456, height = 368 ') "<br/> onClick =" MM_openBrWindow ('.. /photo/nlife/sfc/pages/Trad 'r sam_jpg.htm', 'rd', 'width = 456, height = 368 ') "<br/> onClick =" MM_openBrWindow ('.. /photo/nlife/sea/pages/Mondo's Beach Pub_jpg.htm ', 'RD', 'width = 456, height = 368 ') "<br/> onClick =" MM_openBrWindow ('.. /photo/nlife/tam/pages/Mirage (Moet's) _jpg.htm ', 'RD', 'width = 456, height = 368 ') "<br/> onClick =" MM_openBrWindow ('.. /photo/nlife/tem/pages/Macayo's-N Central_jpg.htm ', 'RD', 'width = 456, height = 368 ') "> <br/> onClick =" MM_openBrWindow ('.. /photo/nlife/tem/pages/RT o'sullivans_jpg.htm', 'RD ', 'width = 456, height = 368') "<br/> onClick =" MM_openBrWindow ('.. /photo/nlife/nyc/pages/Pat O 'Hurley's Bar & grill_jpg.htm', 'RD ', 'width = 456, height = 368 ') "</p> <input type =" text "id =" txregulatory "value =" (\ w) \ '(\ w) "> <input type =" text "id =" txtTo "value =" $1 \ '$2 "> <input type =" button "onclick =" txtDes. value = txtSrc. value. replace (new RegExp (txreg. value, 'ig '), txtTo. value); "value =" replace "> <textarea id =" txtDes "rows =" 15 "cols =" 80 ">
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]