List Info

Thread: Need one Regular Expression




Need one Regular Expression
user name
2006-05-14 13:20:00
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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Need one Regular Expression
user name
2006-05-14 14:31:25
u cannot formally split it b/c there is no distinctive split
pattern
here. what u can do is match the input as 3 groups: (.NET
syntax)

\A(?si)(?<group_1>\[.*?\])\s*(?<group_2>\[.
*?\])\s*(?<group_3>.*?)\Z

(SingleOption ON and IgnoreCase On enforced in the syntax of
the regex
**(?si)**

SO the groups will be:

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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Need one Regular Expression
user name
2006-05-14 16:29:07
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.

you may try this pattern:

    \A(\[[^]]*\])\s*(\[[^]]*\])\s*(.*)\z

or if you have a "split" function, you can use
the following pattern to
split your string into three pieces:

    (?<=\])\s+

Xicheng

> thanks,
> Lucky


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )