![]() Preserved Topic: RegExp (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Lebanon |
![]() Hello... code: <a prop1='xxx' prop2='yyy' href='image1.jpg' prop3='xxx'>big image</a>
|
Paranoid (IV) Inmate From: |
![]() the easy way is: |
Paranoid (IV) Inmate From: Lebanon |
![]() 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 |
![]() I haven't tested this code thoroughly, but it should work fine... |
Paranoid (IV) Inmate From: |
![]() these are way better than mine, alright!! |
Paranoid (IV) Inmate From: Lebanon |
![]() Thanks mr. Max! It works fine! |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() 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 |
![]() |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() BTW, one little part of that thing Max gave can be simplified just a bit... |
Paranoid (IV) Inmate From: Lebanon |
![]() Thanks mr.Max and Slime. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() Hmm... |
Paranoid (IV) Inmate From: Lebanon |
![]() 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 |
![]() Slime, mr. Max, anyone? |
Paranoid (IV) Inmate From: Lebanon |
![]() code: txt = [
|