List Info

Thread: Matching the same group in two different places - possible?




Matching the same group in two different places - possible?
user name
2006-05-15 14:41:19
I'm trying to match the same group of three digits in two
places in my
strings.  Is this possible?

I want to match the digits a string of this type:

LDAP://OU=458 Users,OU=458,OU=Teams,DC=

The above string should return a match but this should fail:

LDAP://OU=458 Users,OU=459,OU=Teams,DC=

This is the pattern that I'm using to match it at the mo:

^LDAP://OU=[0-9][0-9][0-9]
Users,OU=[0-9][0-9][0-9],OU=WRBR,DC=

Is there a way to get a match only if the two
[0-9][0-9][0-9] bits are
the same.

SSG


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Matching the same group in two different places - possible?
user name
2006-05-15 15:34:15
use backreference to group 1: your 3 digits

^LDAP://OU=(\d+) Users,OU=\1,OU=Teams,DC=

it'll match the case with 2 identical digit sequences but
fails if the
numbers are not the same


--~--~---------~--~----~------------~-------~--~----~
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-2]

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