PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Jul 25, 2017 9:37 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Sep 09, 2015 3:54 am 
Offline
Forum Newbie

Joined: Wed Sep 09, 2015 3:43 am
Posts: 1
Hi all, i have some problem matching everything except a specific pattern. I post an example:

My string is:
test 1) test2 3) test3 22) test5 34)

What i need to select is everithing except 1) 3) 22) 34)

I used this (?!\d+\)). but this pattern match only the numbers. I mean the result is : test ) test2 ) test3 ) test5 )
Instead I would like to have this: test test2 test3 test5

How can I do to do that?
Thanks in advance


Top
 Profile  
 
PostPosted: Wed Sep 09, 2015 9:59 am 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13419
Location: New York, NY, US
You could try negative lookahead, something like: "/(?! [0-9]*\)))/"

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group