Regex for (A) and (B) to find in Bus Stop (A) or (B)

Started by Shaozhong SHIover 4 years ago4 messagesgeneral
Jump to latest
#1Shaozhong SHI
shishaozhong@gmail.com

What is the regex for (A) and (B) to find in Bus Stop (A) or (B)?

Regards, David

#2Shaozhong SHI
shishaozhong@gmail.com
In reply to: Shaozhong SHI (#1)

What is the regex for (A) and (B) to find in Bus Stop (A) or (B)?

Regards, David

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Shaozhong SHI (#1)
Re: Regex for (A) and (B) to find in Bus Stop (A) or (B)

On Wednesday, November 3, 2021, Shaozhong SHI <shishaozhong@gmail.com>
wrote:

What is the regex for (A) and (B) to find in Bus Stop (A) or (B)?

Not tested…

^Bus\sStop\s\((\w)\)\sor\((\w)\)$

The \s can just written as a space though the above seems clearer in email
(though it allows for non-space whitespace too)

David J.

#4David G. Johnston
david.g.johnston@gmail.com
In reply to: David G. Johnston (#3)
Re: Regex for (A) and (B) to find in Bus Stop (A) or (B)

On Wednesday, November 3, 2021, David G. Johnston <
david.g.johnston@gmail.com> wrote:

On Wednesday, November 3, 2021, Shaozhong SHI <shishaozhong@gmail.com>
wrote:

What is the regex for (A) and (B) to find in Bus Stop (A) or (B)?

Not tested…

^Bus\sStop\s\((\w)\)\sor\((\w)\)$

The \s can just written as a space though the above seems clearer in email
(though it allows for non-space whitespace too)

Sorry, the actual matcher probably should be something like:
[^)]+

So it matches everything except the closing paren. If the value can
contain a paren its more complicated and I’d need to test and check to
figure it out.

David J.