Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Regex: Inserting a quote character into link with grepWin tool

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
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

916 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