Test Strings:
first.second.third.last
Match result:
first
second
third
fourth
I was able to match only for first.second
using pattern .*(?=\.)|(?<=\.).*
.
When I use this in console "licence.name".match(/(.*(?=\.))|(?<=\.).*/)
, it returns an Array with licence, on regex101.com the result is different it match produces:
match 1 licence
match 2 ''
match 3 name
Why is the match result different for JavaScript and regex101.com?
What I want is, in JavaScript match()
function to return the desired match array.