1.1.5 • Published 8 months ago

sr_match_capture v1.1.5

Weekly downloads
5
License
UNLICENSED
Repository
github
Last release
8 months ago

match-capture - apply match instructions, capture match results

matchArr_match function used to match and capture according to array of match instructions.

  import { iMatchCapture, iMatchItem, matchArr_match } from 'sr_match_capture';

  // matchArr. repeating keyword enclosed values.
  const arr: iMatchItem[] = [
    { oper: 'identifier', captureName: 'keyword', zeroMoreWhitespace: true },
    { oper: 'text', text: '(', zeroMoreWhitespace: false },
    { oper: 'repeatBegin', captureName:'args'},
    { oper: 'identifier', doCapture:true, zeroMoreWhitespace: true },
    { oper: 'or' },
    { oper: 'literal', doCapture:true, zeroMoreWhitespace: true },
    { oper: 'repeatMatchText', text:':', zeroMoreWhitespace:true},
    { oper: 'repeatEnd' },
    { oper: 'text', text: ')', zeroMoreWhitespace: true },
  ]
  const text = 'overlay(sditno:jim:25)';
  const match = matchArr_match(text, 0, arr );
  const { keyword, args } = match.capture ;
1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago