| | |
Regex, HTML and Certain Links
Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Dec 2008
Posts: 9
Reputation:
Solved Threads: 0
Hello all,
Wondering if someone can direct me to a regex component and some code that I can use to strip out certain links from an HTML file (loading in a StringList).
Example:
<a href="../foo/23134.htm">bar</a>
The result I'm after is:
bar
I only want to strip the link here, but not all links from the page, only ones that contain the ../foo directory in their link. Also, the text within the link needs to stay.
Thanks.
Wondering if someone can direct me to a regex component and some code that I can use to strip out certain links from an HTML file (loading in a StringList).
Example:
<a href="../foo/23134.htm">bar</a>
The result I'm after is:
bar
I only want to strip the link here, but not all links from the page, only ones that contain the ../foo directory in their link. Also, the text within the link needs to stay.
Thanks.
Last edited by mawst; Dec 19th, 2008 at 6:33 pm.
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
Join Date: Dec 2008
Posts: 9
Reputation:
Solved Threads: 0
<a [^>]*?href="[^"]+?../cathen/*"[^>]*?>(.+?)</a> <--- I need that fixed
That's what I have so far, but the "." and "*" symbols... I'm not sure what I'm doing wrong here.
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
Regex is a simple but powerful tool. Once you grasp the meaning of bits, it will be very useful and in delphi its one of the fastest methods of searching for non specific text
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
![]() |
Similar Threads
- Starting Python (Python)
- CNAME records (PHP)
- Paser? (Java)
- Regex Help (Computer Science)
- Upload_err_no_tmp_dir (PHP)
- executing unix commands from php (PHP)
- Slide In, Slide Out, ala Digg (JavaScript / DHTML / AJAX)
- boost regex 1_34_1 problem (C++)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: Pascal Help!
- Next Thread: Sorting Issue...?
Views: 1038 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for Pascal and Delphi






