Re: [libreoffice-users] regular expression in formula to investigate
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
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
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
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
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