我有一个字符串,其中包含不同数量的 Url。我想删除每个 Url 的“?category_id=x”部分。x 将是一个不断变化的数字。
var old_string = "some text <a href='/platforms/item/something?category_id=x'>some text</a> some more text <a href='/platforms/item/something?category_id=x'>some text</a>..."
var new_string = "some text <a href='/platforms/item/something'>some text</a> some more text <a href='/platforms/item/something'>some text</a>...."
我怎样才能做到这一点。正则表达式?