IT Community - Software Programming, Web Development and Technical Support

Can any one give regular expression for this string?

This is a discussion on Can any one give regular expression for this string? within the PHP Programming forums, part of the Web Development category; hi, Can any one give solution for this using Regular Expression or any other php functions? I have the string: $...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 07-24-2007, 06:26 AM
raj raj is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
raj is on a distinguished road
Default Can any one give regular expression for this string?

hi,

Can any one give solution for this using Regular Expression or any other php

functions?

I have the string:

$vStr = ' hi this "Raj Test" regular "expression functions" '

i want split this string using space but any string within the double quotes

you should take as single word.


i want to store an array like this:

$arrVal = ("hi", "this", "Raj Test", "regular", "expression functions")
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-24-2007, 11:42 PM
velhari velhari is offline
D-Web Programmer
 
Join Date: Mar 2007
Location: Chennai
Posts: 67
velhari is on a distinguished road
Send a message via AIM to velhari
Thumbs up Re: Can any one give regular expression for this string?

Quote:
Originally Posted by raj View Post
hi,

Can any one give solution for this using Regular Expression or any other php

functions?

I have the string:

$vStr = ' hi this "Raj Test" regular "expression functions" '

i want split this string using space but any string within the double quotes

you should take as single word.


i want to store an array like this:

$arrVal = ("hi", "this", "Raj Test", "regular", "expression functions")

Hi Raj,

For Your Query, I found that answer and i hope that its a Correct one.

Here the Code for your query about Splitting a string blahhh......

PHP Code:

$vStr 
' hi this "Raj Test" regular "expression functions" ';
$arrVal preg_split("/\s(\"[a-zA-Z]+\s[a-zA-Z]+\")*/",$vStr,-1,PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);

print_r$arrVal); 
Regards,
VELHARI
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/php-programming/2661-can-any-one-give-regular-expression-string.html
Posted By For Type Date
actionscript: Blogs, Photos, Videos and more on Technorati This thread Refback 07-24-2007 06:33 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is regular expression? saravanan PHP Programming 8 03-28-2008 06:12 AM
How to use Regular expression in Java? S.Vinothkumar Java Programming 3 11-28-2007 08:45 PM
Regular expression tips & tricks prasath Database Support 8 09-24-2007 09:55 PM
Regular expression Sathish Kumar C# Programming 23 09-10-2007 06:00 AM
Regular expression vadivelanvaidyanathan Perl 0 07-15-2007 06:21 PM


All times are GMT -7. The time now is 09:45 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0