seperating a string

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
shoaib
Forum Newbie
Posts: 5
Joined: Wed Feb 18, 2009 10:17 am

seperating a string

Post by shoaib »

hello

i want to seperate a string,

i mean if a value passed in the form like srb123 34rb5

i want a function who can seperate a string and integar and echo it seperately

like (srb ) and (123) first example
like (345) and (rb) second example

i am waiting for the reply
thanks
shoaib
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: seperating a string

Post by prometheuzz »

shoaib wrote:hello

i want to seperate a string,

i mean if a value passed in the form like srb123 34rb5

i want a function who can seperate a string and integar and echo it seperately

like (srb ) and (123) first example
like (345) and (rb) second example

i am waiting for the reply
thanks
shoaib
If you're not familiar with regex, I wouldn't use it.
If you are familiar with it however, please ask a specific question about it. I mean, now it just looks like you're trying to find someone to do your (home) work. The saying "learn a man to fish instead of feeding him" applies here nicely, IMO.

So, if you post what you have already tried yourself and explain what went wrong with it, I'm more than happy to give you a hand with it. But, you can also just ignore me and wait for someone else to hand you a copy-and-paste answer. You decide!

Good luck!
shoaib
Forum Newbie
Posts: 5
Joined: Wed Feb 18, 2009 10:17 am

Re: seperating a string

Post by shoaib »

buddy i new to php i m learning it but i m stuck here if have tried different loops but simply don't get the result .

i just want to know the way how to do it.

thanks for the reply
prometheuzz wrote:
shoaib wrote:hello

i want to seperate a string,

i mean if a value passed in the form like srb123 34rb5

i want a function who can seperate a string and integar and echo it seperately

like (srb ) and (123) first example
like (345) and (rb) second example

i am waiting for the reply
thanks
shoaib
If you're not familiar with regex, I wouldn't use it.
If you are familiar with it however, please ask a specific question about it. I mean, now it just looks like you're trying to find someone to do your (home) work. The saying "learn a man to fish instead of feeding him" applies here nicely, IMO.

So, if you post what you have already tried yourself and explain what went wrong with it, I'm more than happy to give you a hand with it. But, you can also just ignore me and wait for someone else to hand you a copy-and-paste answer. You decide!

Good luck!
User avatar
prometheuzz
Forum Regular
Posts: 779
Joined: Fri Apr 04, 2008 5:51 am

Re: seperating a string

Post by prometheuzz »

shoaib wrote:buddy i new to php i m learning it but i m stuck here if have tried different loops but simply don't get the result .

i just want to know the way how to do it.

thanks for the reply
No problem.
User avatar
GeertDD
Forum Contributor
Posts: 274
Joined: Sun Oct 22, 2006 1:47 am
Location: Belgium

Re: seperating a string

Post by GeertDD »

shoaib wrote:buddy i new to php i m learning it but i m stuck here if have tried different loops but simply don't get the result.
Well, you could do it without regex if you want to. Loop over each character, do a ctype_digit check and fill two strings.
Post Reply