- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: Scala Regex + data generation
Thu, 2011-08-04, 15:36
I mean, shouldn't. :-)
On Thu, Aug 4, 2011 at 11:34, Daniel Sobral wrote:
> Oh, yes. Mind you, you'd have to translate a regex string into
> WordExp, but it should be hard.
>
> On Thu, Aug 4, 2011 at 11:32, Daniel Sobral wrote:
>> On Wed, Aug 3, 2011 at 22:41, Antonio Jr. Mattos wrote:
>>> I'm quite new to scala, maybe may question was already answered but I
>>> couldn't find it.
>>> I'm developing a tool to generate test data. A user will define a regex to
>>> represent the input data for the application under test . From this regex,
>>> the tool must generate some data samples.
>>> So, in short, I want to do the reverse way i.e., instead of matching a
>>> string
>>> against the regex I wanna extract some strings from the regex.
>>> Is there a library that already implements something like this?
>>
>> There's a library in Scala that generates automata from regular
>> expressions. One can use such an automatum to generate the string. I
>> give an example below -- the code isn't particularly pretty, as I
>> haven't refactored or anything. And I'd rather produce a ScalaCheck
>> Gen, so it could be used with ScalaCheck tests as well. But... here it
>> is:
>>
>> https://gist.github.com/1125284
>>
>> --
>> Daniel C. Sobral
>>
>> I travel to the future all the time.
>>
>
>
>
> --
> Daniel C. Sobral
>
> I travel to the future all the time.
>