Skip to content
This repository has been archived by the owner on Jan 17, 2018. It is now read-only.

Evaluate sample data against the regex #23

Open
alastairs opened this issue Jan 4, 2013 · 5 comments
Open

Evaluate sample data against the regex #23

alastairs opened this issue Jan 4, 2013 · 5 comments

Comments

@alastairs
Copy link

It would be really useful to be able to test out the regex on sample data as well. E.g., for a regex of "\d+", perhaps I might throw the following sample data at it:

  • "a"
  • ""
  • "0"
  • "235"
  • "aslfj235"

A really cool thing to do with this would be to highlight the path through the state machine that is taken when evaluating a piece of sample data.

@javallone
Copy link
Owner

I don't expect this feature will be added in the near future, but I'm going to keep it around since it does sound like a good idea.

At this point, the expression is not being compiled into a state machine, it is merely being parsed enough to render the image. I haven't done any research into generating the state machine, or the difficulties that may be encountered with tracing the path through that machine, but from past reading I understand that it is not a trivial problem.

I will keep this in mind though.

@mustefa
Copy link

mustefa commented Jan 6, 2013

+1 for being able to test out the regex.

@paulproteus
Copy link

One simplistic way to implement this is to run client-side JS that executes the regex against a given string, rather than processing it via the state machine representation.

There are a few other regex demo sites on the web, and I think they just do the above. Might as well eat their lunch and win their users by gaining their features!!

@paulproteus
Copy link

@aldeka , curious if you'd be interested in hacking on this sometime.

@ForbesLindesay
Copy link

I'm intending to go down that route initially for http://regexplained.co.uk but it does have the downside of not being able to see the path taken through the railroad diagram.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants