Skip to content

possible variables in regular expresssions

August 23, 2011

I have wanted to create regular expressions which do not necessarily have variables passed to them, example, something that matches both of these:

Given a CIM subscription is set up
Given a CIM subscription: "my subscription" is set up

Here is the answer:

Given a CIM subscription(?:: "([^"]*)")? is set up

check this link: http://rubular.com/r/kfr1tgPzjQ

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: