Need one Regular Expression

L

Lucky

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
 
G

Guest

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.+)$"
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

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*(.+)$"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top