Preserved Topic: RegExp |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: Lebanon |
posted 08-12-2001 11:53
Hello... code: <a prop1='xxx' prop2='yyy' href='image1.jpg' prop3='xxx'>big image</a>
|
Paranoid (IV) Inmate From: |
posted 08-13-2001 06:38
the easy way is: |
Paranoid (IV) Inmate From: Lebanon |
posted 08-13-2001 08:39
I've built this code, but it ain't very optimal...looking forward for a better code, that only reads the HREF form only "A" tag! code: str = "<a href=\"asd.txt\" prop1='aasd'>dadasD</a>";
|
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 08-13-2001 09:38
I haven't tested this code thoroughly, but it should work fine... |
Paranoid (IV) Inmate From: |
posted 08-13-2001 13:16
these are way better than mine, alright!! |
Paranoid (IV) Inmate From: Lebanon |
posted 08-14-2001 11:15
Thanks mr. Max! It works fine! |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 08-14-2001 13:12
putting a ? after a + or a * or some other things means minimal matching. In other words, .+? means match any character one or more times, but only as few times as possible (as opposed to as many times as possible, which is what happens without the question mark). So, if the pattern would work with 2 characters there, or with 20 characters there, it will try to match it with 2 characters, and only go on to 20 if that doesn't work. |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 08-14-2001 19:21 |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 08-14-2001 21:00
BTW, one little part of that thing Max gave can be simplified just a bit... |
Paranoid (IV) Inmate From: Lebanon |
posted 08-19-2001 11:42
Thanks mr.Max and Slime. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 08-19-2001 16:17
Hmm... |
Paranoid (IV) Inmate From: Lebanon |
posted 08-19-2001 18:11
I would also like to know how to do this with the .replace method of RegExp. code: txt = ["[ url=http://www.karl.nu/slime/ ]slime's page[ /url ]",
|
Paranoid (IV) Inmate From: Lebanon |
posted 08-21-2001 08:45
Slime, mr. Max, anyone? |
Paranoid (IV) Inmate From: Lebanon |
posted 09-04-2001 11:34
code: txt = [
|