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

大佬们。在线蹲个 JS 正则表达式

  •  
  •   MrFantasyJay · Jul 20, 2020 · 2445 views
    This topic created in 2147 days ago, the information mentioned may be changed or developed.

    一个字符串,必须含有 _ 下划线,且下划线的两边必须有字符

    ex: 123_sdw

    10 replies    2020-07-20 18:12:36 +08:00
    SakuraKuma
        1
    SakuraKuma  
       Jul 20, 2020
    字符? 什么字符.

    /[^_]+_\w+/
    xiaoming1992
        2
    xiaoming1992  
       Jul 20, 2020
    /(?<=\w)_(?=\w)/g.test(str)
    MrUser
        3
    MrUser  
       Jul 20, 2020
    /.+_.+/
    ChenFanlin
        4
    ChenFanlin  
       Jul 20, 2020
    \w_\w
    颜表情
    netnr
        5
    netnr  
       Jul 20, 2020
    .*_.*
    baocaixiong
        6
    baocaixiong  
       Jul 20, 2020
    /[^ ]+_[^ ]+/g
    MrFantasyJay
        7
    MrFantasyJay  
    OP
       Jul 20, 2020
    不好意思,各位大佬,两边的字符限制为数字和英文字母...
    whitehack
        8
    whitehack  
       Jul 20, 2020
    /[0-9a-zA-Z]+_[0-9a-zA-Z]+/
    lovecy
        9
    lovecy  
       Jul 20, 2020
    你这个问题实在太简陋了,
    至少给一个结果集,要求全部匹配
    或者再加一个禁止匹配的集合
    IceSolStice
        10
    IceSolStice  
       Jul 20, 2020
    ^([0-9a-zA-Z][-.\w]*_([0-9a-zA-Z][-.\w]*)$
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2858 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 66ms · UTC 04:08 · PVG 12:08 · LAX 21:08 · JFK 00:08
    ♥ Do have faith in what you're doing.