Mapped attribute and regex not returning expected result

Lipscomb, Gary glipscomb at csu.edu.au
Mon Apr 30 19:57:36 EDT 2018


Hi Scott, Tom

Using this ^(\d*)(.?)(.*) now gives the expected results [1]

Have also tested using aacli and results confirmed.

Regards

Gary

[1] results using http://www.regexplanet.com/advanced/java/index.html  (and is now bookmarked)

Test         Target String         matches()         replaceFirst()         replaceAll()         lookingAt()         find()         n [start(n),end(n)] group(n)
1                12345678                Yes                                                                                          Yes                         Yes              0: [0,8] 12345678
                                                                                                                                                                                                           1: [0,8] 12345678
                                                                                                                                                                                                           2: [8,8]
                                                                                                                                                                                                           3: [8,8]

2                12345678A             Yes                                                                                          Yes                          Yes             0: [0,9] 12345678A
                                                                                                                                                                                                           1: [0,8] 12345678
                                                                                                                                                                                                           2: [8,9] A
                                                                                                                                                                                                           3: [9,9]

3                1234A                     Yes                                                                                           Yes                            Yes           0: [0,5] 1234A
                                                                                                                                                                                                           1: [0,4] 1234
                                                                                                                                                                                                           2: [4,5] A
                                                                                                                                                                                                           3: [5,5]

4               1234A5678            Yes                                                                                            Yes                           Yes            0: [0,9] 1234A5678
                                                                                                                                                                                                           1: [0,4] 1234
                                                                                                                                                                                                           2: [4,5] A
                                                                                                                                                                                                           3: [5,9] 5678


-----Original Message-----
From: users [mailto:users-bounces at shibboleth.net] On Behalf Of Cantor, Scott
Sent: Tuesday, 1 May 2018 09:12
To: Shib Users <users at shibboleth.net>
Subject: RE: Mapped attribute and regex not returning expected result

> Using https://regex101.com/ the above expression returns Group 1 as '1234'
> and Group 2 as 'A'

Notwithstanding that only actual Java code/testing matters, I believe the issue is that the code only performs replacement if the expression as a whole matches the input, and according to the Java test sites of that nature, the actual match result is false.

e.g. http://www.regexplanet.com/advanced/java/index.html

-- Scott

-- 
For Consortium Member technical support, see https://wiki.shibboleth.net/confluence/x/coFAAg
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net


More information about the users mailing list