Files
2012-02-21 01:15:00 -05:00

1 line
2.0 KiB
JSON

[{"user_id": 3580, "stars": [], "topic_id": 16831, "date_created": 1301706519.950958, "message": "so I wanna concat in the \"cat|dog|mouse\" part... any suggestions?", "group_id": 160, "id": 507069}, {"user_id": 3580, "stars": [], "topic_id": 16831, "date_created": 1301706502.5145459, "message": "my regex is like s.replace(/\\b(cat|dog|mouse)\\b/gi, \"whatevs\")", "group_id": 160, "id": 507065}, {"user_id": 3580, "stars": [], "topic_id": 16831, "date_created": 1301706468.0955231, "message": "I wanna construct a regex with some literal strings in it that I need to be dynamic...", "group_id": 160, "id": 507060}, {"user_id": 1151, "stars": [{"date_created": 1301709503.7941451, "user_id": 3580}], "topic_id": 16831, "date_created": 1301709332.42362, "message": "Something like var cat = \"cat\", dog = \"dog\"; RegExp(\"\\\\b\" + cat + \"|\" + dog + \"\\\\b\").test(\" dog \") will work.", "group_id": 160, "id": 507196}, {"user_id": 3580, "stars": [], "topic_id": 16831, "date_created": 1301709501.2031331, "message": "thanks.. yeah, the RegExp constructor is where I landed.. worked out!", "group_id": 160, "id": 507212}, {"user_id": 8327, "stars": [], "topic_id": 16831, "date_created": 1301788427.402431, "message": "var\ns = 'test string',\nlist = ['cat', 'dog', 'mouse'],\npattern = RegExp('\\\\b(' + list.join('|') + ')\\\\b', 'gi'),\ns2 = s.replace(pattern, 'whatevs');", "group_id": 160, "id": 510964}, {"user_id": 6627, "stars": [{"date_created": 1302032599.5892861, "user_id": 8327}], "topic_id": 16831, "date_created": 1301987252.055052, "message": "Surprised to see you don't need a \"new\" in there. But playing around with it, I don't see any obvious differences between what you get with \"new RegExp(...)\" and \"RegExp(...)\".", "group_id": 160, "id": 537205}, {"user_id": 8327, "stars": [], "topic_id": 16831, "date_created": 1302032887.5614991, "message": "@util You're quite right, there should be a new in there to prevent context leakage, it does still work, it's just not advisable. Nice catch.", "group_id": 160, "id": 545492}]