troubleshooting Question

Regular Expression

Avatar of SnO2d
SnO2d asked on
8 Comments1 Solution255 ViewsLast Modified:
table name = 'dbo.EXCHANGE', constraint name blah blah DELETE FROM dbo.EXCHANGE WHERE exchangeCode blah blah table name = 'dbo.EXCHANGE', constraint name = blah blah

I am trying to create a regular expression which will only find the word EXCHANGE once in the above string,
specifically in the '...DELETE FROM dbo.EXCHANGE WHERE...'

The regular expression I am trying to create is:

String regex = "[dbo]{1}.([A-Z]+?).[WHERE]{1}";
Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);

However when I pring out what is found by the matcher, I get:

while (matcher.find()) {

      System.out.print(matcher.start(1) + "-" + matcher.end(1) + ": ");

Can someone tell me the regex I need to use. I need to include the flag 'Pattern.DOTALL' when compiling the pattern.
There can also be any number of underscores (including none) in the table name, for example:



Thank you

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros