•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 401,573 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,335 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1074 | Replies: 1
![]() |
•
•
Join Date: Apr 2007
Location: Glasgow::Scotland
Posts: 10
Reputation:
Rep Power: 2
Solved Threads: 2
This is really a regular expression question opposed to a .NET but I can't see any forum that specialises in that kind of thing, so as I'm using ASP.NET I figured I'd post it here 
I have a string as such...
And I want to match each of the href="*" and replace them, however my regular expression skills are non-existant! I've got this far...
href=".*\.aspx" but that returns just one match:
href="Welcome.aspx">Welcome</a>
</li>
<li>
<as href="About.aspx
Which isn't very useful... can anyone fix my regular expression?
Cheers,
Blackred.

I have a string as such...
<ul>
<li>
<a href="Welcome.aspx">Welcome</a>
</li>
<li>
<as href="About.aspx">About us</a>
</li>
</ul>And I want to match each of the href="*" and replace them, however my regular expression skills are non-existant! I've got this far...
href=".*\.aspx" but that returns just one match:
href="Welcome.aspx">Welcome</a>
</li>
<li>
<as href="About.aspx
Which isn't very useful... can anyone fix my regular expression?
Cheers,
Blackred.
This station is non-operational.
•
•
Join Date: May 2006
Location: Bellevue, WA
Posts: 1,548
Reputation:
Rep Power: 8
Solved Threads: 51
regex: href=\"[^\"]\.aspx\"
Yours was matching from the first href to the end of the second one because of the .* whereas mine allows anything except for a closing quote (and therefore stops at the end of the first one). It's not as anal as I usually get with regex, but as long as you have well-formed XHTML it should work.
Yours was matching from the first href to the end of the second one because of the .* whereas mine allows anything except for a closing quote (and therefore stops at the end of the first one). It's not as anal as I usually get with regex, but as long as you have well-formed XHTML it should work.
Last edited by Infarction : Jul 24th, 2007 at 10:37 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Email send in ASP.NET with "Accept en Deny" link (ASP.NET)
- Why app is looking for "Default.aspx" (ASP.NET)
- Windows 2000 Adv Server and "Printing Subsystem" (Windows NT / 2000 / XP / 2003)
- Error loading "bridge.dll" (Viruses, Spyware and other Nasties)
- "Preparing to stand by..." (Windows NT / 2000 / XP / 2003)
Other Threads in the ASP.NET Forum
- Previous Thread: Autopostback in Firefox
- Next Thread: Arabic label in ASP.NET dispalys junk chars



Linear Mode