Re: Pattern alternation on entire line

2020-02-10 Thread Tom Robinson
Ah, thanks Sam!  (and Jean-Christophe)


> On 2020-02-11, at 11:12, Sam Hathaway  wrote:
> 
> ^ and $ bind more tightly than |.
> 
> you want
> 
> ^(s|(e?h?))$

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/30E3A765-AD1E-45E1-9EF6-F04BF377D51F%40gmail.com.


Re: Pattern alternation on entire line

2020-02-10 Thread Jean-Christophe Helary



> On Feb 11, 2020, at 6:58, Tom Robinson  wrote:
> 
> What have I missed here guys?
> 
> I want to match entire lines which are empty, contain a single ’s’, or 
> contain ‘e’ and/or ‘h’ (in that order):
> 
> e
> h
> eh
> s
> 
> ehs
> he
> x
> 
> The first 5 lines should match (including the empty line), last 3 shouldn’t.
> 
> But despite the caret anchor, my pattern is catching the ending of unwanted 
> lines:
> 
> ^s|(e?h?)$

Tom,

The results are

[e]
[h]
[eh]
[s]
[]
ehs
h[e]
x
[]

So, it looks like the regex works like this:

^s

or

(e?h?)$

This one: ^s$|^(e?h?)$ seems to do what you want.


Jean-Christophe Helary
---
http://mac4translators.blogspot.com @brandelune


-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/876A6DC3-19BF-491A-8F64-9CD162C79D4C%40traduction-libre.org.


Re: Pattern alternation on entire line

2020-02-10 Thread Sam Hathaway

`^` and `$` bind more tightly than `|`.

you want

```
^(s|(e?h?))$
```

On 10 Feb 2020, at 16:58, Tom Robinson wrote:


What have I missed here guys?

I want to match entire lines which are empty, contain a single 
’s’, or contain ‘e’ and/or ‘h’ (in that order):


e
h
eh
s

ehs
he
x

The first 5 lines should match (including the empty line), last 3 
shouldn’t.


But despite the caret anchor, my pattern is catching the ending of 
unwanted lines:


^s|(e?h?)$

--
This is the BBEdit Talk public discussion group. If you have a feature 
request or need technical support, please email 
"supp...@barebones.com" rather than posting here. Follow @bbedit on 
Twitter: 

---
You received this message because you are subscribed to the Google 
Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/1068812A-8CAC-4C07-94F6-E36B3CA756F7%40gmail.com.


--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "supp...@barebones.com" rather than posting here. 
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/216D42D3-8604-4290-9A27-AE71F8822934%40munkynet.org.


Pattern alternation on entire line

2020-02-10 Thread Tom Robinson
What have I missed here guys?

I want to match entire lines which are empty, contain a single ’s’, or contain 
‘e’ and/or ‘h’ (in that order):

e
h
eh
s

ehs
he
x

The first 5 lines should match (including the empty line), last 3 shouldn’t.

But despite the caret anchor, my pattern is catching the ending of unwanted 
lines:

^s|(e?h?)$

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/1068812A-8CAC-4C07-94F6-E36B3CA756F7%40gmail.com.