Coder Social home page Coder Social logo

3f / regxwild Goto Github PK

View Code? Open in Web Editor NEW
26.0 9.0 6.0 435 KB

⏱ Superfast ^Advanced wildcards++? | Unique algorithms that was implemented on native unmanaged C++ but easily accessible in .NET via Conari (with caching of 0x29 opcodes +optimizations) etc.

License: MIT License

C++ 84.00% C 2.23% Batchfile 9.05% C# 4.71%
regex regexp wildcards strings text filter search match search-in-text fast-regex

regxwild's Issues

Disable Meta-Symbols

v1 - Same char to escape

  • 1024*2 -> 10247412
  • 1024**2 -> 1024*2
  • 1024***2 -> 1024*0xD2
  • one|two -> one or two
  • one||two -> one|two
  • one|||two -> one| or two
  • one||||two -> one||two
  • one|||||two -> one|| or two
  • one|*||two -> one or |two
  • one|*||||two -> one or ||two

... for each available meta-symbol

upd: no, ESS version provides #, that means 1 any symbol, thus we cannot use this because of: track-num:*###7400 and similar.

v2 - markers via flags

We'll add @ + special flag ([a-z0-9] only) + @@ to escape this flag

Then we can use unified combinations of this, for example:

  • @ + d for disable all meta-symbols before new @(?) -> @d ... @
    • 1024*2 -> 10247412
    • 1024@d*@2 -> 1024*2 or @d1024*2@ -> 1024*2
    • @d1024*@*2 -> 1024*0xD2
    • @@d1024*@*2 -> @@d1024*@0xD2 -> note: @* ok (@ + [a-z0-9])
    • one|two -> one or two
    • @done|two@ -> one|two
    • @done|@|two -> one| or two
    • @done||two@ -> one||two
    • @done||@|two -> one|| or two
    • one|@d|two@ -> one or |two
    • one|@d||two@ -> one or ||two

well, this is more powerful way, but probably more hard for view o_o and:

  • v2: one|@d||two@ <- ?@done|@@d||two@@@
  • v1: one|@d||two@ <- one||@@d||||two@@

v3 - markers via single tilde '~'

v2 can also be as simple ~ ... ~ + to escape ~~:

  • one|@d||two@ <- ~one|@d||two@~
  • one|~d||two~ <- ~one|~~d||two~~~

Special markers & Flags

To use additional syntax, we can add special markers & flags

The entry point like:

  • Single: @x ...
  • Pair: @x ... @

Where x the any supported combination, like single symbol [0-9a-z] or complex expressions like {1,7}.

This related for #1 (v2 - markers via flags), but the main idea to extend syntax for support additional features like the following below.

Sub-Issues

  • #4 - Capture data for all quantifiers
  • #5 - Control of newline symbols
  • #1 - Disable Meta-Symbols

Special symbol-logic like for current '>'

MS_ANYSP = _T('>'), // as [^/]* //TODO: >\>/ i.e. '>' + {symbol}

  • @B> ...

etc.

non-/whitespace character + std. quantifiers

Add any variant for using of whitespace & non-whitespace character/s

v1 - single meta-symbol + std. quantifier

  • % - whitespace + quantifier *?+#
  • & - non-whitespace + quantifier *?+#

for example:

  • 1%+5 -> 125, 12345, ...
  • 1%##5 -> 1235, 1775, ...
  • 1%?5 -> 15, 125, 145, ...
  • 1%*5 -> 123467895, 15, ...

configurable % + & like:

search(const TCHAR* data, const TCHAR* filter, const TCHAR* whsp, const TCHAR* nonwhsp)
_T("qwerty012345...")
_T("	 ")

or simply:

search(const TCHAR* data, const TCHAR* filter, const TCHAR* whsp)
_T("	 ") - all except this is a non-whitespace character

but the first variant is more flexible for using special set of characters for both cases of % + &

Capture data for all quantifiers

The most lightweight way (+Speed) implement flag to enable capturing data by default for all quantifiers *?+#

  • @c ... enabled ...
  • @c ... enabled ... @c ... disabled ...

example:

  • @c12*5 a?d 34+7
    • 12005 and 3417
      • -> $1 - 00
      • -> $2 - n
      • -> $3 - 1

Alternative

Speed - is most important, because the regex engine much more powerful anyway.

v2:

  • @c ... @
    • 12@c*@7 - > 12457 accessor: $n

v3 (overhead):

  • @c flag - switch to enable () for capturing
    • @c12(*)7 - > 12457 accessor: $1 - 45
    • escape \(\) or (())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.