Re: [libreoffice-users] REGEX difficulty

2021-05-21 Thread hymie
David Lynch writes:
>On the other hand, if I enter =REGEX("29791","(?=(29|79|97))",,1)
>
>I get a zero length string.
>
>Can anyone help please?

https://stackoverflow.com/questions/1570896/what-does-mean-in-a-regular-expression

(?=pattern) is a zero-width positive lookahead assertion. For example,
/\w+(?=\t)/ matches a word followed by a tab, without including the tab.

So it looks to me like you are trying to match nothing followed by a 29,
and you are successfully matching nothing.

=REGEX("29791","((78|87))",,1)   tells me "#N/A" , which I suppose is
what you get when a regex fails.  Yours succeeds and returns an empty
string.

--hymie! http://nasalinux.net/~hymiehy...@nasalinux.net

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy



Re: [libreoffice-users] REGEX difficulty

2021-05-21 Thread Tony Arnold
Hi David,

On Fri, 2021-05-21 at 17:19 +0100, David Lynch wrote:
> If I use the REGEX tester 
> with regular expression (?=(29|79|97))
> and test string 29791
> I get 3 matches 29, 97,79, as I expect.
> On the other hand, if I enter =REGEX("29791","(?=(29|79|97))",,1)

I think you have to escape the parentheses vis:

=REGEX("29791","\(?=\(29|79|97\)\)",,1)

that yields 79

Regards,
Tony.
-- 
Tony Arnold MBCS, CITP | Senior IT Security Analyst | Directorate of IT 
Services | Office 1, Kilburn Building | The University of Manchester | 
Manchester M13 9PL | T: +44 161 275 6093 | M: +44 773 330 0039

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy


Re: [libreoffice-users] REGEX difficulty

2021-05-21 Thread Bo Siltberg
What flavour of regex are we talking about?
Can you show us how you get three matches here.
I can only see that there will be one match, 29, 79 or 97.
Furthermore, if you intend to use this as a "lookahead", there is something
missing in the regex, the prefix that shall be matched if it is followed by
one of these numbers, and in this case, only 29 will make that prefix match.
If you provide the help description of the parameters to REGEX() I'm sure
we can find an explanation of its behaviour.


Den fre 21 maj 2021 kl 18:22 skrev David Lynch :

> If I use the REGEX tester 
>
> with regular expression (?=(29|79|97))
>
> and test string 29791
>
> I get 3 matches 29, 97,79, as I expect.
>
> On the other hand, if I enter =REGEX("29791","(?=(29|79|97))",,1)
>
> I get a zero length string.
>
> Can anyone help please?
>
> David Lynch
>
> Version: 7.1.3.2 (x64) / LibreOffice Community
> Build ID: 47f78053abe362b9384784d31a6e56f8511eb1c1
> CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: Skia/Raster;
> VCL: win
> Locale: en-GB (en_GB); UI: en-GB
> Calc: threaded
>
>
> --
> To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
> Problems?
> https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
> Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
> List archive: https://listarchives.libreoffice.org/global/users/
> Privacy Policy: https://www.documentfoundation.org/privacy
>

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy


[libreoffice-users] REGEX difficulty

2021-05-21 Thread David Lynch

If I use the REGEX tester 

with regular expression (?=(29|79|97))

and test string 29791

I get 3 matches 29, 97,79, as I expect.

On the other hand, if I enter =REGEX("29791","(?=(29|79|97))",,1)

I get a zero length string.

Can anyone help please?

David Lynch

Version: 7.1.3.2 (x64) / LibreOffice Community
Build ID: 47f78053abe362b9384784d31a6e56f8511eb1c1
CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; 
VCL: win

Locale: en-GB (en_GB); UI: en-GB
Calc: threaded


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy