我不知道我在做什麼錯。我有這個字符串,我想更換到最後一個標記(已經在一個字符串中)RegEx
<?xml version="1.0" encoding="utf-8" ?>
<Sections>
<Section>
我使用正則表達式來代替一切,包括<Section>
,並留下其餘不變。
arrayValues[index].replace("/[([.,\n,\s])*<Section>]/", "---");
我的正則表達式有什麼問題?這是否意味着要包括---
(包括<Section>
)在內的所有字符,包括新行和空格?
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags – Kristian
託尼?託尼?託尼? –
@kristian http://meta.stackexchange.com/questions/182189/please-stop-linking-to-the-zalgo-anti-cthulhu-regex-rant,除此之外,正則表達式可以解析HTML就好了,儘管普遍的看法。 – sgroves