When using the g option, `lastIndex` is set on the regexp to indicate where the next search will begin. See https://developer.mozilla.org/en/JavaScript/Guide/Regular_Expressions#Advanced_Searching_With_Flags
Also, this is a Javascript question, not node. On Tuesday, March 13, 2012 1:45:32 AM UTC-7, Yi wrote: > > var reg = /[^\$]*\$([^\|]*)\|?(.*)/g > var a = '$3ec05baeef7' > reg.test(a) > //output: true > reg.test(a) > //output: false > reg.test(a) > //output: true > reg.test(a) > //output: false > reg.test(a) > //output: true > reg.test(a) > //output: false > reg.test(a) > //output: true > reg.test(a) > //output: false > reg.test(a) > //output: true > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
