ida
ida

Reputation: 545

how get only the full matched string from regular expression

/[-+]?\d+([,.]\d+)*/gm

test:
156,1651,5e6116

if i use the above string for test it is selecting partially. how to get only the full matched string ? i'm using the above regex for Javascript

Upvotes: 1

Views: 37

Answers (1)

vks
vks

Reputation: 67978

/^[-+]?\d+([,.]\d+)*$/gm

Use anchors ^$ to get only a full match and not partial match.

Upvotes: 2

Related Questions