quantifiers

Closures and universal quantification

I've been trying to work out how to implement Church-encoded data types in Scala. It seems that it requires rank-n types since you would need a first-class const function of type forAll a. a -> (forAll b. b -> b). However, I was able to encode pairs thusly: import scalaz._ trait Compose[F[_],G[_]] { type Apply = F[G[A]] } trait Closu...

Javascript Invalid quantifier in regex

The regex is constructed on the fly, but I've output it to firebug: (.{1,38})(+|$\n?) the error is invalid quantifier +|$\n?) I don't even know what invalid quantifier means! I really feel like I'm going to get the "Show us something relevant" answer, but I'm not sure where to start. The actual code is: var re = top.RegExp; var ...

Java Pattern match

Hi All, I've a long template from which I need to extract certain strings based on certain patterns. When I went through some examples I found that use of quantifiers is good in such situations.For example following is my template, from which I need to extract while and doWhile. This is a sample document. $while($variable)This text can ...

How to create a .NET Regex with a dynamic quantifier

I am trying to extract blocks of JSON data from a data stream in the following format: Some-Header-Name:Value Content-Length:Value Some-Other-Header:Value {JSON data string of variable length} The stream contains many instances of the above pattern and the length of JSON data in each instance is different, as indicat...