Jump to content

simple pregmatch inverted


nadeemshafi9

Recommended Posts

hi guys

 

can somone give me some links to some solid manuals

 

this is my string #image,100#

 

i need to get the 100

 

any ideas

 

im just about to dl a cheetsheet will be back soon to see what has been suggested, this is the first regex of this new job of mine so iim slightly out of knowledge on it atm, was using it a lot at the last job

 

http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/

 

should be bale to knock something up i n a bit

Link to comment
Share on other sites

this is my string #image,100#

 

i cant find anything to negate /#image.*#/ regexp, so im thinking its the wrong way to go about it, do i really need regex in this ?

 

split the string by ,

 

strip off #image

and #

 

actualy if i can negate  regexp /#image.*#/

 

i can then split the result by ,

Link to comment
Share on other sites

I take it it always says #image then? You could simply use trim to remove the hashes then explode on the comma. But if you want to use Regular Expressions then something like...

 

~^#image,(\d{3})#~

 

That of course assumes the 100 is always a 3 digit number. You can modify that accordingly.

Link to comment
Share on other sites

I take it it always says #image then? You could simply use trim to remove the hashes then explode on the comma. But if you want to use Regular Expressions then something like...

 

~^#image,(\d{3})#~

 

That of course assumes the 100 is always a 3 digit number. You can modify that accordingly.

 

thanku

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.