I have this regex /{([\d,-]+)}/
which is used to highlight lines in markdown and allows input in this format - {2,3-6,8}
. Now, I wanted to include showLineNumbers
prop in it too such as {2,3-6,8,showLineNumbers}
and couldn't figure regex for this. I have tried this regex /{([\d\bshowLineNumbers\b,-]+)}/
but this still results in matched in following examples:
{1,2,3,ssssss}
{1,2,3,show}
But the expected value, should only have showLineNumbers
prop one time, inside the curly brackets regardless of position. For eg: {showLineNumbers,3,5,6}
, {3,5, showLineNumbers,6}
, etcetera. should match the regex format. Where did I make a mistake in this format - /{([\d\bshowLineNumbers\b,-]+)}/
?