推荐关注
› Meteor
› JSLint - a JavaScript code quality tool
› jsFiddle
› D3.js
› WebStorm
推荐书目
› JavaScript 权威指南第 5 版
› Closure: The Definitive Guide
zxCoder

js 正则表达式怎么匹配 |

  •  
  •   zxCoder · Oct 30, 2021 · 2311 views
    This topic created in 1831 days ago, the information mentioned may be changed or developed.

    我想用|和-分割字符串

    split(/||-/)

    第一个|要怎么写,\|吗?好像不行

    user4201
    user4201
    Oct 30, 2021
    1
    split(/[-|]/)
    2i2Re2PLMaDnghL
    2i2Re2PLMaDnghL
    Oct 30, 2021
    2
    "123|456-789".split(/\||-/)
    Array(3) [ "123", "456", "789" ]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1514 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 18:14 · PVG 02:14 · LAX 10:14 · JFK 13:14
    ♥ Do have faith in what you're doing.