valoricDe / MultiRegExp2

Get all matches of a regexp with corresponding start and end positions
GNU General Public License v3.0
12 stars 5 forks source link

CDN link , web distribution #9

Open mafar opened 5 years ago

mafar commented 5 years ago

It will be very helpful if there is a CDN link so that lib can be tested .

https://github.com/valoricDe/MultiRegExp2/blob/master/dist/multiRegExp2.js file is also wrong for web distribution as ther is no UMD wrapper

Just paste code in any jsfiddle and run to see compatibility

mafar commented 5 years ago

for UMD npm install --save-dev babel-plugin-transform-es2015-modules-umd then create .babelrc file with content

{
  "plugins": ["transform-es2015-modules-umd"]
}

and then run npm build nw you will have universal module for any env , distribution

mafar commented 5 years ago

Here is fiddle https://jsfiddle.net/bababalcksheep/o4qn7jwe/48/ with UMD

and this lib does not work correctly for nested groups. https://jsfiddle.net/bababalcksheep/o4qn7jwe/48/ from this, try query and str and comapre match with regex101.com

valoricDe commented 5 years ago

I added a build for iife for browsers (https://raw.githubusercontent.com/valoricDe/MultiRegExp2/master/dist/multiRegExp2.js). In the jsfiddle I do not see nested regexps. Could you write the regexp here and the expected output?

mafar commented 5 years ago

https://regex101.com/r/V16o77/1 see this string aaaaaaaaaaaaaa regex /a(a*)a/g

In ur case , full matach which is first result is ok , But 2nd group is not , not the match , not the start end as well

image

mafar commented 5 years ago

in any case, consider using UMD over iife , requireJs is still around

valoricDe commented 5 years ago

I added UMD

regarding the matches. I added a testcase for your issue and it correctly returns a matching group with start 1 and end 13. Could you clone the project and run npm test?

valoricDe commented 5 years ago

new MultiRegExp2(/a(a*)a/).execForAllGroups("aaaaaaaaaaaaaa", false) TestCase 7 passed: => [{"match":"aaaaaaaaaaaa","start":1,"end":13}]

mafar commented 5 years ago

Give me sometime and i will make a jsfiddle with all of my test cases . thankx

mafar commented 5 years ago

Moving on here https://github.com/valoricDe/MultiRegExp2/issues/10 CLOSE this issue and consider using jsdeliver or any other CDN for this repo. multiRegExp2.js umd and iife should be deliverable , for web moslty

and with UMD present , there is no need of iife

mafar commented 5 years ago

no dist folder at https://www.jsdelivr.com/package/npm/multi-regexp2