Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Regex: Inserting a quote character into link with grepWin tool

Posted on 2011-09-30
4
Medium Priority
?
275 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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As most anyone who uses or has come across them can attest to, regular expressions (regex) are a complicated bit of magic. Packed so succinctly within their cryptic syntax lies a great deal of power. It's not the "take over the world" kind of power,…
We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
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…
Suggested Courses

722 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