Re: [libreoffice-users] regular expression for calc

2017-03-13 Thread Steve Edmonds

Did the OP get this working.
I have it working with
=COUNTIF(SEARCH("\b"&$G$37&"\b",E37:E39),">1")

$G$37 contains the search term with word boundaries.
E37:E39 is the range I am searching.

Enter into the cell where you want the answer 
=COUNTIF(SEARCH("\b"&$G$37&"\b",E37:E39),">1") and press CTL + SFT + Enter


Steve

On 2017-03-13 13:46, Bruce Hohl wrote:

If the code you are looking for only occurs once per cell you could use
find() or search() against each cells to determine if the code is present
then countif() the results where greater than zero.

On Sun, Mar 12, 2017 at 1:50 PM, Regina Henschel 
wrote:


Hi Gary,

find the option "Search criteria = and <> must apply to whole cells" in
Tools > Options > Calc > Calculate. Try it with disabled option.

Kind regards
Regina

Gary Collins schrieb:


Hi Brian
I wish i could say it did help but unfortunately not. It works with the
whole cell contents but doesnt seem to pick out a word within the cell. For
instance, one of my list has contents "X1 G43". Now if I have "X1 G43" in
the cell Xn (using your example) i get count 1 returned which is correct;
but if i have "X1" in cell Xn it returns 0, which is clearly wrong (at
least as far as my requirements are concerned). And yes, i do have regular
expressions enabled in Calc >  Calculate. My version is 5.2.2.2 x64 and im
using 64bit windows 7.

G.



--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-uns
ubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be
deleted




--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


Re: [libreoffice-users] regular expression for calc

2017-03-13 Thread Gary Collins
Hi Regina,
Thank you, yes, that's cracked it. (*so* many pitfalls for the unwary!)

Best
Gary

On Sun, 12/3/17, Regina Henschel <rb.hensc...@t-online.de> wrote:

 Subject: Re: [libreoffice-users] regular expression for calc
 To: users@global.libreoffice.org
 Date: Sunday, 12 March, 2017, 17:50
 
 Hi Gary,
 
 find the option "Search
 criteria = and <> must apply to whole cells" in
 
 Tools > Options > Calc >
 Calculate. Try it with disabled option.
 
 Kind regards
 Regina
 
 Gary Collins schrieb:
 > Hi
 Brian
 > I wish i could say it did help
 but unfortunately not. It works with the whole cell contents
 but doesnt seem to pick out a word within the cell. For
 instance, one of my list has contents "X1 G43".
 Now if I have "X1 G43" in the cell Xn (using your
 example) i get count 1 returned which is correct; but if i
 have "X1" in cell Xn it returns 0, which is
 clearly wrong (at least as far as my requirements are
 concerned). And yes, i do have regular expressions enabled
 in Calc >  Calculate. My version is 5.2.2.2 x64 and im
 using 64bit windows 7.
 >
 > G.
 
 
 -- 
 To unsubscribe e-mail to:
 users+unsubscr...@global.libreoffice.org
 Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
 Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
 List archive: http://listarchives.libreoffice.org/global/users/
 All messages sent to this list will be publicly
 archived and cannot be deleted
 

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


Re: [libreoffice-users] regular expression for calc

2017-03-12 Thread Bruce Hohl
If the code you are looking for only occurs once per cell you could use
find() or search() against each cells to determine if the code is present
then countif() the results where greater than zero.

On Sun, Mar 12, 2017 at 1:50 PM, Regina Henschel 
wrote:

> Hi Gary,
>
> find the option "Search criteria = and <> must apply to whole cells" in
> Tools > Options > Calc > Calculate. Try it with disabled option.
>
> Kind regards
> Regina
>
> Gary Collins schrieb:
>
>> Hi Brian
>> I wish i could say it did help but unfortunately not. It works with the
>> whole cell contents but doesnt seem to pick out a word within the cell. For
>> instance, one of my list has contents "X1 G43". Now if I have "X1 G43" in
>> the cell Xn (using your example) i get count 1 returned which is correct;
>> but if i have "X1" in cell Xn it returns 0, which is clearly wrong (at
>> least as far as my requirements are concerned). And yes, i do have regular
>> expressions enabled in Calc >  Calculate. My version is 5.2.2.2 x64 and im
>> using 64bit windows 7.
>>
>> G.
>>
>
>
> --
> To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
> Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-uns
> ubscribe/
> Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
> List archive: http://listarchives.libreoffice.org/global/users/
> All messages sent to this list will be publicly archived and cannot be
> deleted
>

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


Re: [libreoffice-users] regular expression for calc

2017-03-12 Thread Regina Henschel

Hi Gary,

find the option "Search criteria = and <> must apply to whole cells" in 
Tools > Options > Calc > Calculate. Try it with disabled option.


Kind regards
Regina

Gary Collins schrieb:

Hi Brian
I wish i could say it did help but unfortunately not. It works with the whole cell contents but doesnt seem to 
pick out a word within the cell. For instance, one of my list has contents "X1 G43". Now if I have 
"X1 G43" in the cell Xn (using your example) i get count 1 returned which is correct; but if i have 
"X1" in cell Xn it returns 0, which is clearly wrong (at least as far as my requirements are 
concerned). And yes, i do have regular expressions enabled in Calc >  Calculate. My version is 5.2.2.2 x64 
and im using 64bit windows 7.

G.



--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


Re: [libreoffice-users] regular expression for calc

2017-03-12 Thread Gary Collins
Hi Brian
I wish i could say it did help but unfortunately not. It works with the whole 
cell contents but doesnt seem to pick out a word within the cell. For instance, 
one of my list has contents "X1 G43". Now if I have "X1 G43" in the cell Xn 
(using your example) i get count 1 returned which is correct; but if i have 
"X1" in cell Xn it returns 0, which is clearly wrong (at least as far as my 
requirements are concerned). And yes, i do have regular expressions enabled in 
Calc >  Calculate. My version is 5.2.2.2 x64 and im using 64bit windows 7.

G.

On Sun, 12/3/17, Brian Barker <b.m.bar...@btinternet.com> wrote:

 Subject: Re: [libreoffice-users] regular expression for calc
 To: users@global.libreoffice.org
 Date: Sunday, 12 March, 2017, 5:51
 
 At 15:45 11/03/2017 +, Gary
 Collins wrote:
 >I have a column each row of which contains a sequence of
 one or more 
 >codes separated by a space. In case it will make a
 difference each 
 >code consists of a letter (occasionally 2 letters)
 followed by a 
 >number of up to 3 digits (and occasionally ends with a
 letter) eg X1 
 >Aa12 D7a etc.
 >
 >I want to obtain a regular expression for COUNTIF that
 will enable 
 >me to find out how many times a particular code,
 contained in 
 >another cell, occurs in the column. I was thinking that
 \b to detect 
 >the word boundaries should help but i cant quite get it
 to work; im 
 >not sure if this is because it is assuming a word
 boundary between 
 >the letter and the number or if it is simply my
 incompetence as 
 >usual. Does anyone have an idea what may be the best way
 to achieve this?
 
 Try
 =COUNTIF(range;"\b"&"\b")
 - where "range" represents the column of data and Xn
 represents the 
 cell containing the code to be counted. Remember that you
 need to 
 have Tools | Options... | LibreOffice Calc | Calculate |
 Enable 
 regular expressions in formulae ticked (which is the case by
 default).
 
 I trust this helps.
 
 Brian Barker
 
 
 -- 
 To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
 Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
 Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
 List archive: http://listarchives.libreoffice.org/global/users/
 All messages sent to this list will be publicly archived and
 cannot be deleted
 
 

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


Re: [libreoffice-users] regular expression for calc

2017-03-11 Thread Brian Barker

At 15:45 11/03/2017 +, Gary Collins wrote:
I have a column each row of which contains a sequence of one or more 
codes separated by a space. In case it will make a difference each 
code consists of a letter (occasionally 2 letters) followed by a 
number of up to 3 digits (and occasionally ends with a letter) eg X1 
Aa12 D7a etc.


I want to obtain a regular expression for COUNTIF that will enable 
me to find out how many times a particular code, contained in 
another cell, occurs in the column. I was thinking that \b to detect 
the word boundaries should help but i cant quite get it to work; im 
not sure if this is because it is assuming a word boundary between 
the letter and the number or if it is simply my incompetence as 
usual. Does anyone have an idea what may be the best way to achieve this?


Try
=COUNTIF(range;"\b"&"\b")
- where "range" represents the column of data and Xn represents the 
cell containing the code to be counted. Remember that you need to 
have Tools | Options... | LibreOffice Calc | Calculate | Enable 
regular expressions in formulae ticked (which is the case by default).


I trust this helps.

Brian Barker


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



[libreoffice-users] regular expression for calc

2017-03-11 Thread Gary Collins
Apologies if this appears twice; im not sure if there was a problem with 
sending...

Hello,
I have a column each row of which contains a sequence of one or more codes 
separated by a space. In case it will make a difference each code consists of a 
letter (ooccasionally 2 letters) followed by a number of up to 3 digits (and 
occasionally ends with a letter) eg X1 Aa12 D7a etc.

I  want to obtain a regular expression for COUNTIF that will enable me to find 
out how many times a particular code, contained in another cell, occurs in the 
column. I was thinking that \b to detect the word boundaries should help but i 
cant quite get it to work; im not sure if this is because it is assuming a word 
boundary between the letter and the number or if it is simply my incompetence 
as usual.

Does anyone have an idea what may be the best way to achieve this?

Thanks
Gary

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


[libreoffice-users] regular expression for calc

2017-03-11 Thread Gary Collins
Hello,
I have a column each row of which contains a sequence of one or more codes 
separated by a space. In case it will make a difference each code consists of a 
letter (ooccasionally 2 letters) followed by a number of up to 3 digits (and 
occasionally ends with a letter) eg X1 Aa12 D7a etc.

I  want to obtain a regular expression for COUNTIF that will enable me to find 
out how many times a particular code, contained in another cell, occurs in the 
column. I was thinking that \b to detect the word boundaries should help but i 
cant quite get it to work; im not sure if this is because it is assuming a word 
boundary between the letter and the number or if it is simply my incompetence 
as usual.

Does anyone have an idea what may be the best way to achieve this?

Thanks
Gary

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


[libreoffice-users] Regular Expression

2014-05-28 Thread Keith Bates
Hi,

I'm in unfamiliar territory, searching a QIF file for a single badly formatted 
transaction. I've exported the original moneydance file to a tab limited file 
with 
the thought of searching for a non-numeric character in the transaction amount 
column.

The only problem is I can't work out the appropriate Reg. Exp to search for 
characters that are not numeric or a .  My brain just refuses to twist into 
the 
required contortions to work out regular expressions!

Can someone give me the formula required in the Find box in libre office 
please?


Keith Bates
New Life Christian Fellowship
Ph 02 67924890

Jesus is the Way,
the Turth and the Life.

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] Regular Expression

2014-05-28 Thread Jim Seymour
On Wed, 28 May 2014 21:32:17 +1000
Keith Bates ke...@new-life.org.au wrote:

 Hi,
 
 I'm in unfamiliar territory, searching a QIF file for a single badly
 formatted transaction. I've exported the original moneydance file to
 a tab limited file with the thought of searching for a non-numeric
 character in the transaction amount column.
 
 The only problem is I can't work out the appropriate Reg. Exp to
 search for characters that are not numeric or a .
[snip]

You want to find everything that's *not* in a particular set, so...

[^0-9\.]

That's anything that's not zero thru nine or a (literal) dot.

Depending upon the flavour of regexp support, that can also be written
[^[:digit:]\.] or [^\d\.], but the first one I gave works with any
flavour.

HTH

Regards,
Jim
-- 
Note: My mail server employs *very* aggressive anti-spam
filtering.  If you reply to this email and your email is
rejected, please accept my apologies and let me know via my
web form at http://jimsun.LinxNet.com/contact/scform.php.

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] Regular Expression

2014-05-28 Thread Keith Bates
 Brian Barker
 
 PS: What's Turth, please?

Brian,

Thanks for your suggestion. I went with the Reg. Exp method but still unable to 
find the rogue transaction that throws the error.

I could say that Turth is a kind of post-modern rejection of truth, but that 
would 
be suggesting that Jesus is not quite the truth. :)

I've now fixed the typo as you can see,


Keith Bates
New Life Christian Fellowship
Ph 02 67924890

Jesus is the Way,
the Truth and the Life.

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] Regular Expression

2014-05-28 Thread Keith Bates
Thanks Jim.
That worked, although it didn't solve my problem with the QIF file

Keith 
On Wed, 28 May 2014 08:00:37 AM Jim Seymour wrote:
 On Wed, 28 May 2014 21:32:17 +1000
 
 Keith Bates ke...@new-life.org.au wrote:
  Hi,
  
  I'm in unfamiliar territory, searching a QIF file for a single badly
  formatted transaction. I've exported the original moneydance file to
  a tab limited file with the thought of searching for a non-numeric
  character in the transaction amount column.
  
  The only problem is I can't work out the appropriate Reg. Exp to
  search for characters that are not numeric or a .
 
 [snip]
 
 You want to find everything that's *not* in a particular set, so...
 
 [^0-9\.]
 
 That's anything that's not zero thru nine or a (literal) dot.
 
 Depending upon the flavour of regexp support, that can also be written
 [^[:digit:]\.] or [^\d\.], but the first one I gave works with any
 flavour.
 
 HTH
 
 Regards,
 Jim


Keith Bates
New Life Christian Fellowship
Ph 02 67924890

Jesus is the Way,
the Truth and the Life.

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] regular expression in formula to investigate

2013-08-27 Thread yahoo-pier_andreit

On 08/27/2013 01:37 AM, Brian Barker wrote:

At 21:35 26/08/2013 +0200, Pier Andreit wrote:

as you know is there some way to start search from the right of strings??


Not directly that I know of.  I think you just need to use the $
character - as here - to lock the pattern you are matching to the end of
the text (or of a paragraph, in the case of a text document).


...in technology we trust. for now only USB beer... :-) :-) :-) :-)


Ho, ho!  Splendid!  Thanks.


P.S. sorry if my bad english can generate misunderstanding, I'm only
joking :-)


It's perfectly understandable.

Brian Barker




...:-) :-) :-) many thanks...:-) :-)

--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] regular expression in formula to investigate

2013-08-26 Thread yahoo-pier_andreit

On 08/25/2013 01:35 AM, Brian Barker wrote:

At 23:26 24/08/2013 +0200, Pier Andreit wrote:

[...]
I cannot understand this part:
SEARCH(/[^/]*$, CELL(filename))
I know it search in CELL(filename) but I cannot understand the
criteria /[^/]*$ from the tests it seems to find the last / in any
string, and if you substitute the / with . it works again finding
the last ., it is very useful  :-) :-) :-) :-)

could somebody so marvellously noble and well-bred to explain the
regular expressions here used??


I'm not even ordinarily noble - certainly not marvellously so - and I
was only ordinarily bred; will I do?



...enough noble to be opensource knight...:-) :-)


The first character in the text string is the slash that you are looking
for.  A string in square brackets matches any single character which
appears in that string.  But if the first character is a circumflex (as
here), it matches any single character *not* in that string.  So
leftbracket-circumflex-slash-rightbracket matches any single character
other than a slash.  The asterisk following this pattern causes a match
with zero or more characters (as many as possible, in fact) preceding it
- in this case the bracketed string.  So the bracketed part followed by
the asterisk together match as many characters as possibly not including
a slash.  The dollar sign locks the pattern to the end of a paragraph -
in this case, the end of the entire text in the cell.  So the whole
string finds a slash followed by many not-slash characters, but only at
the end of the string.  As you say, that means everything from the last
slash in the string to the end.  The SEARCH() function then returns the
position of the start of the matched text: the position of the last slash.



thank you very much, I understood now, and I will better study regular 
expressions...:-)

as you know is there some way to start search from the right of strings??


...a couple of beer paid for you...:-) :-) :-)


How kind!  I'll enquire of my mail service provider how soon they can
permit liquid attachments.



...in technology we trust. for now only USB beer... :-) :-) :-) :-)
http://beer.about.com/od/beertastinganddrinking/ig/Beer-Gadgets--Gizmos---Goodies/-Beer--Filled-USB-Flash-Drive.htm
but I don't know the flavour...
...and if you pass from Latina-Italy email to me, a real beer can be 
found more easily...:-) :-)



I trust this helps.

Brian Barker



ciao, Pier

P.S. sorry if my bad english can generate misunderstunding, I'm only 
joking :-)


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



Re: [libreoffice-users] regular expression in formula to investigate

2013-08-26 Thread Brian Barker

At 21:35 26/08/2013 +0200, Pier Andreit wrote:

as you know is there some way to start search from the right of strings??


Not directly that I know of.  I think you just need to use the $ 
character - as here - to lock the pattern you are matching to the end 
of the text (or of a paragraph, in the case of a text document).



...in technology we trust. for now only USB beer... :-) :-) :-) :-)


Ho, ho!  Splendid!  Thanks.

P.S. sorry if my bad english can generate misunderstanding, I'm only 
joking :-)


It's perfectly understandable.

Brian Barker


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted



[libreoffice-users] regular expression in formula to investigate

2013-08-24 Thread yahoo-pier_andreit
I found this very beautiful and useful formula to estract filename in a 
cell:


=REPLACE(REPLACE(CELL(filename),FIND(.,CELL(filename),1),(LEN(CELL(filename))-FIND(.,CELL(filename),1)+1),),1,SEARCH(/[^/]*$, 
CELL(filename)),)


I cannot understand this part:
SEARCH(/[^/]*$, CELL(filename)
I know it search in CELL(filename)
but I cannot understund the criteria /[^/]*$

from the tests it seems to find the last / in any string, and if you 
substitute the / with . it works again finding the last ., it is 
very useful  :-) :-) :-) :-)


could somebody so marvellously noble and well-bred to explain the 
regular eapressions here used??


...a couple of beer paid for you...:-) :-) :-)

manythanks, ciao, pier

--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


Re: [libreoffice-users] regular expression in formula to investigate

2013-08-24 Thread Brian Barker

At 23:26 24/08/2013 +0200, Pier Andreit wrote:

[...]
I cannot understand this part:
SEARCH(/[^/]*$, CELL(filename))
I know it search in CELL(filename) but I cannot understand the 
criteria /[^/]*$ from the tests it seems to find the last / in 
any string, and if you substitute the / with . it works again 
finding the last ., it is very useful  :-) :-) :-) :-)


could somebody so marvellously noble and well-bred to explain the 
regular expressions here used??


I'm not even ordinarily noble - certainly not marvellously so - and I 
was only ordinarily bred; will I do?


The first character in the text string is the slash that you are 
looking for.  A string in square brackets matches any single 
character which appears in that string.  But if the first character 
is a circumflex (as here), it matches any single character *not* in 
that string.  So leftbracket-circumflex-slash-rightbracket matches 
any single character other than a slash.  The asterisk following this 
pattern causes a match with zero or more characters (as many as 
possible, in fact) preceding it - in this case the bracketed 
string.  So the bracketed part followed by the asterisk together 
match as many characters as possibly not including a slash.  The 
dollar sign locks the pattern to the end of a paragraph - in this 
case, the end of the entire text in the cell.  So the whole string 
finds a slash followed by many not-slash characters, but only at the 
end of the string.  As you say, that means everything from the last 
slash in the string to the end.  The SEARCH() function then returns 
the position of the start of the matched text: the position of the last slash.



...a couple of beer paid for you...:-) :-) :-)


How kind!  I'll enquire of my mail service provider how soon they can 
permit liquid attachments.


I trust this helps.

Brian Barker


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted