0

I'm trying to get only 2 commas matched after a specific word match

this is a test, fun(a, b, fun(a, b, another(a, b, c))) another(a, ,a, ,)

I need it return only 4 commas (inside fun not another) matched instead all 11

/fun*(,)/ // I need to write it correct

I need to write this regex for a parser using http://zaa.ch/jison/try/ see the ignore regex mentioned

/* lexical grammar */
%lex
%%

\s+                   /* skip whitespace */
([fun])*(,)           /* I need to skip this here */
[0-9]+("."[0-9]+)?\b  return 'NUMBER'

see the below

https://www.regextester.com/?fam=106380

  • What do you want to get as a result? – Wiktor Stribiżew Dec 05 '18 at 18:10
  • I need it to create a parser using https://github.com/zaach/jison – Sanjay Nishad Dec 05 '18 at 18:11
  • Please include your code (espacially your regex) instead of an external link. – Poul Bak Dec 05 '18 at 18:12
  • Be explicit in what you need as *output* for the given example. I find it hard to believe that you would want as output ",,,,". – trincot Dec 05 '18 at 19:11
  • `([fun])*` matches a string of arbitrary length (possibly empty) consisting only of the letters `f`, `n` and `u`. It would match, for example, uff, fnuu and nuun. It seems unlikely that is what you want to do. You might want to seek an introduction to regular expressions. – rici Dec 05 '18 at 19:41

0 Answers0