Hi,
Sorry for a certainly silly question but regex group matching always fails.. What is wrong with this:
conString := "jdbc:oracle:thin:@(DESCRIPTION = (LOAD_BALANCE = OFF)(ADDRESS = (PROTOCOL = TCP)(HOST = hostName)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = someService) ))" deviceReg := Regex <|.*HOST\s?=\s?(\w+).*|> device := deviceReg.matcher(conString).group(1); echo ("device = $device");
I always get: sys::Err: No match found
sys::Err: No match found
When I plug the values into the Fantex website the regex seems to work fine - group(1) returns hostname.
group(1)
hostname
But I notice you're not calling RegexMatcher.find() before grabbing the group. Try this:
RegexMatcher.find()
conString := "..." deviceReg := "...".toRegex matcher := deviceReg.matcher(conString) matcher.find() device := matcher.group(1) echo ("device = $device");
Thanks a lot. That did it...
The initial err msg of sys::Err: No match found when no match has been attempted is misleading though. Perhaps it should be updated?
Yes, indeed. Why not call find before attempting to return the group in case it wasn't called before?
Login or Signup to reply.
ahhatem Thu 12 Apr 2018
Hi,
Sorry for a certainly silly question but regex group matching always fails.. What is wrong with this:
I always get:
sys::Err: No match found
SlimerDude Thu 12 Apr 2018
When I plug the values into the Fantex website the regex seems to work fine -
group(1)
returnshostname
.But I notice you're not calling
RegexMatcher.find()
before grabbing the group. Try this:ahhatem Thu 12 Apr 2018
Thanks a lot. That did it...
SlimerDude Thu 12 Apr 2018
The initial err msg of
sys::Err: No match found
when no match has been attempted is misleading though. Perhaps it should be updated?ahhatem Thu 12 Apr 2018
Yes, indeed. Why not call find before attempting to return the group in case it wasn't called before?