1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<xsl:function name="functx:replace-multi" as="xs:string?" xmlns:functx="http://www.functx.com"> <xsl:param name="arg" as="xs:string?"/> <xsl:param name="changeFrom" as="xs:string*"/> <xsl:param name="changeTo" as="xs:string*"/> <xsl:sequence select=" if (count($changeFrom) > 0) then functx:replace-multi( replace($arg, $changeFrom[1], functx:if-absent($changeTo[1],'')), $changeFrom[position() > 1], $changeTo[position() > 1]) else $arg "/> </xsl:function> |
1 2 3 4 5 6 7 |
<xsl:variable name="fr" select="('[a-c]', 'def', '\d+')"/> <xsl:variable name="to" select="('x', 'y', '0')"/> XPath Example Results functx:replace-multi('abcdef123',$fr,$to) xxxy0 |
참조 : http://www.xsltfunctions.com/xsl/functx_replace-multi.html
더 간단한 방법
1 2 3 4 5 |
var data = "abc/def/gh"; var result = data.replace(/\//gi, ''); console.log('결과', result); // abcdefgh |
참조 : http://www.codejs.co.kr/%EC%9E%90%EB%B0%94%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8%EC%97%90%EC%84%9C-replace%EB%A5%BC-replaceall-%EC%B2%98%EB%9F%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0/