By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,485 Members | 1,031 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,485 IT Pros & Developers. It's quick & easy.

Need one Regular Expression

P: n/a
hi guys,
i'm practising regular expression. i've got one string and i want it to
split in groups.
i was trying to make one regular expression but i didn't successed.
please help me guys.

i'm using .NET 2.0's Regular expression class.

here is the string.

[Bulk] [symbiancollection] Free English & Indian Movies 36 China Town,
Gangster , Mission impossible 3
i need this output:

group 1 : [Bulk]
group 2 : [symbiancollection]
group 3 : Free English & Indian Movies 36 China Town, Gangster ,
Mission impossible 3

please,please guys help me out with this regular expression. i've found
it interesting but it seems hard to learn this thing.

thanks,
Lucky

May 14 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Try something like: "^([\w+]) ([\w+]) (.+)$"

Lucky wrote:
hi guys,
i'm practising regular expression. i've got one string and i want it to
split in groups.
i was trying to make one regular expression but i didn't successed.
please help me guys.

i'm using .NET 2.0's Regular expression class.

here is the string.

[Bulk] [symbiancollection] Free English & Indian Movies 36 China Town,
Gangster , Mission impossible 3
i need this output:

group 1 : [Bulk]
group 2 : [symbiancollection]
group 3 : Free English & Indian Movies 36 China Town, Gangster ,
Mission impossible 3

please,please guys help me out with this regular expression. i've found
it interesting but it seems hard to learn this thing.

thanks,
Lucky

May 14 '06 #2

P: n/a
Try something like: "^([\w+]) ([\w+]) (.+)$"

I think you need to escape the square brackets, otherwise they're
interpreted as a character set.

If Group 1 and Group 2 are consistently between square brackets,
something more like this should work:

"^(\[.+\])\s*(\[.+\])\s*(\w.+)$"

May 15 '06 #3

P: n/a
sp********@gmail.com wrote:
Try something like: "^([\w+]) ([\w+]) (.+)$"

I think you need to escape the square brackets, otherwise they're
interpreted as a character set.
Yes, of course. My oversight.
If Group 1 and Group 2 are consistently between square brackets,
something more like this should work:

"^(\[.+\])\s*(\[.+\])\s*(\w.+)$"


Yes, that's a bit more flexible. Except perhaps the \w in the third
group. That means that the first character has to be one of A-Za-z_0-9.

"^(\[.+\])\s*(\[.+\])\s*(.+)$"
May 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.