Another good application-regular to find the replacement string _ Regular expression

Source: Internet
Author: User
The following code is intercepted from a Web page source:
onclick= "Mm_openbrwindow ('.. /photo/nlife/sfc/pages/o ' connors_jpg.htm ', ' RD ', ' width=456,height=368 ')
onclick= "Mm_openbrwindow ('.. /photo/nlife/sfc/pages/trad ' r sam_jpg.htm ', ' RD ', ' width=456,height=368 ')
onclick= "Mm_openbrwindow ('.. /photo/nlife/sea/pages/mondo ' s Beach pub_jpg.htm ', ' RD ', ' width=456,height=368 ')
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 ' 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=368 ')
onclick= "Mm_openbrwindow ('.. /photo/nlife/nyc/pages/pat O ' Hurley ' Bar & grill_jpg.htm ', ' RD ', ' width=456,height=368 ')
Here you need to replace the ' batch ' in the link, note that there are spaces in the link, special characters (bars, brackets, &, etc.), and some places ' appear more than once. In the replacement process can not be other places ' and links in the other content, I think with the DW of the regular replacement, I would like to ask how to write the regular expression?
<textarea id= "txtsrc" rows= "cols=" "> onclick=" Mm_openbrwindow (' ... /photo/nlife/sfc/pages/o ' connors_jpg.htm ', ' RD ', ' width=456,height=368 ') "onclick=" Mm_openbrwindow (' ... /photo/nlife/sfc/pages/trad ' r sam_jpg.htm ', ' RD ', ' width=456,height=368 ') ' onclick= ' Mm_openbrwindow (' ... /photo/nlife/sea/pages/mondo ' s Beach pub_jpg.htm ', ' RD ', ' width=456,height=368 ') ' 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 ' 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=368 ') "onclick=" Mm_openbrwindow (' ... /photo/nlife/nyc/pages/pat O ' Hurley ' Bar & grill_jpg.htm ', ' RD ', ' width=456,height=368 ') ' </textarea> < Input type= "text" id= "Txtreg" value= "(\w) \ ' (\w)"/> <input type= "text" id= "Txtto" value= "$1\ ' $"/>    <input type= "button" onclick= "tXtdes.value = TxtSrc.value.replace (New RegExp (Txtreg.value, ' IG '), txtto.value); "value=" Replace "/> <textarea Id= "Txtdes" rows= "cols=" ></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.