Solved

Regex: Inserting a quote character into link with grepWin tool

Posted on 2011-09-30
4
269 Views
Last Modified: 2012-05-12
Hello Experts,

I have links I need to update that exist in the html pages as  

<a href="www.site.com/xxxxx>

Open in new window


the xxxxx is different in every link but is always some letters or numbers. I was able to piece together a Regex search string to find the string which contains the portion I need:

 
www.site.com/(.*?>)

Open in new window


This will match a result that looks like:

 
www.site.com/subdirectory>

Open in new window


Perfect. But, I am lost on what to use in my Regex replace string to insert the quote symbol just before the wicket. Thanks in advance for your assistance.
0
Comment
Question by:JF0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Expert Comment

by:Dangle79
ID: 36893195
short of digging into it because my brain is far from that mode right now, this is the tool i use for building and evaluating regex strings

http://gskinner.com/RegExr/

easy to use and pretty slick
0
 
LVL 16

Author Comment

by:JF0
ID: 36893255
I was looking at that earlier, but it didn't help me find the correct answer. After some further research I think I need to use something called backreferences. I am so lost.

I basically want to match everything before the wicket, and replace it with everything before the wicket + a quote character.
0
 
LVL 10

Accepted Solution

by:
mark_harris231 earned 500 total points
ID: 36893432
Match String: www.site.com/(.*?)>  (matches everything after the backslash to the ending wicket)

Replace string:  www.site.com/$1">

Depending on the regex engine you are using, you may need to use \1 instead of $1
0
 
LVL 16

Author Closing Comment

by:JF0
ID: 36893551
Perfect, thanks!

I couldn't think of how to set the sub dir as the reference - seems so simple now.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Batuhan Cetin Regular expression is a language that we use to edit a string or retrieve sub-strings that meets specific rules from a text. A regular expression can be applied to a set of string variables. There are many RegEx engines for u…
Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question