cookya
cookya

Reputation: 3307

Regular Expressions in F#

I want to write a regular expression in F# that represents strings which start & end with " and can have any sequence of Unicode characters not including double quote or newline.

For example:

"I want to go home"

"My name is cookya "

""

How can I do it?

Upvotes: 1

Views: 633

Answers (2)

aleroot
aleroot

Reputation: 72656

You should use a regular expression like the following :

let regex = "^\".*\"$"

Upvotes: 3

Cylian
Cylian

Reputation: 11182

Ty this

"[^"]*?"

It could work, but parsing and validating this kind of string you might need a stack.

Upvotes: 0

Related Questions