使用JavaScript,来实现JavaScript中的正则,RegExp in JavaScript,方便大家使用自己熟悉的语言调试
测试用例:
"/root/temp/hello.mp3".match(/.+\/(.+\..+)$/)
"noonday".match(/\B../)
"_foo0_(x,y)".match(/^([_a-zA-Z0-9]*)(?:\(.*\))/)
"_foo0_(x,y)".match(/^((?:[_a-zA-Z])+(?:[_a-zA-Z\d])*)(?:\((.*)\))?/)
"0_foo0_(x,y)".match(/^((?:[_a-zA-Z])+(?:[_a-zA-Z\d])*)(?:\((.*)\))?/) // no match
"_foo0_ (x,y)".match(/^((?:[_a-zA-Z])+(?:[_a-zA-Z\d])*)[ ]*(?:\((.*)\))?/)