My mind is getting a little numb with regex. I need to come up with a regular expression to match any of the following scenarios, but so far I have only come up with the following expression that isn't quite working:
(package)(\.)(path)(\s+)(=)( )(').*?..*?..*?..*?(.).*?(')
I need to build two different expressions.
Expression #1 should match any of the following strings.
package.path = 'any string or path here'
package.path = "any string or path here"
package.path='any string or path here'
package.path="any string or path here"
Expression #2. should match any of the following strings.
package.path = package.path .. 'any string or path here'
package.path = package.path .. "any string or path here"
package.path = package.path..'any string or path here'
package.path = package.path.."any string or path here"
package.path=package.path .. 'any string or path here'
package.path=package.path .. "any string or path here"
I would appreciate any help from a Regex Guru out there.
Thanks.
.is a special char in regex, you'll want to escape it with\...or does that symbolize something else?[.].\s+requires space. Sounds like you want space to be optional. That should be\s*.\s?(which many folks are suggesting) is only correct if the most you could have is a single space character. Is that the case, or could there be runs of more than one space?