정규식 생성 라이브러리

오픈소스·2023년 3월 1일
0
post-thumbnail

폰번호 정규식

	const regexp = VerEx()
    			   .startOfLine()
                   .range('0', '9')
                   .repeatPrevious(3)
                   .maybe('-')
                   .range('0', '9')
                   .repeatPrevious(3, 4)
                   .maybe('-')
                   .range('0', '9')
                   .repeatPrevious(4)
                   .endOfLine();

	console.log(regexp.test('010-1234-1234'));

URL 정규식

	const regexp = VerEx()
    			   .startOfLine()
                   .then('http')
                   .maybe('s')
                   .then('://')
                   .anythingBut(' ')
                   .endOfLine();
                   
    console.log(regexp.test('http://naver.com'));

http://verbalexpressions.github.io/JSVerbalExpressions/

  • Rules
    • startOfLine
    • endOfLine
    • then
    • find
    • maybe
    • or
    • anything
    • anythingBut
    • something
    • somethingBut
    • anyOf
    • any
    • not
    • range
  • Special Characters
    • lineBreak
    • br
    • tab
    • word
    • digit
    • whitespace
  • Modifiers
    • addModifier
    • removeModifier
    • withAnyCase
    • stopAtFirst
    • searchOneLine
    • repeatPrevious
  • Loops
    • oneOrMore
    • multiple
  • Capture Groups
    • beginCapture
    • endCapture
  • Miscellaneous
    • replace
    • toRegExp

0개의 댓글