
![]() |
cdc
I'm actually doing this using
PHP's preg_match_all, but I think aregexis aregexis aregexso I posted it here.I'm trying to pull some info off a page. There are several instances of this info spread across the page, and some of them are numbers. I'm not interested in the numbers. So, here's what I would do if I were interested in the numbers: /<tag>(.+?)</tag>/ Which would pull all the information between <tag></tag> on the page. However, I want to remove the ones that are a number so I naively tried this: /<tag>[^0-9]</tag>/ What am I missing? perkiset
Hey C - would you please post an example of what you WOULD like to grab as well as what you wouldn't? That'd be just a bit easier to see.
Thanks! /p dirk
Hi cdc,
your example would match: <tag>a</tag> but not: <tag>ab</tag> So I would change the regexto:/<tag>[^0-9]+?</tag>/ cdc
Thanks, dirk, works like a charm.
Just for completeness, here's an example of something I'd like it to match: <tag>hello</tag> Here's an example of what I don't want to match: <tag>1</tag> So I want to grab everything in the "tag" tag that's NOT a number. perkiset
Sheesh - really was that simple eh?
Sorry C - thought it'd be more complex if you posted some demos /p crypt
D is the same as [^0-9]
d is the same as [0-9] W is the same as [^a-zA-Z0-9] w is the same as [a-zA-Z0-9] i thought there was one for [a-zA-Z], but i don't remember ever using it : ![]() |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads