Libre Writer Macro function string manipulation with regex not working.
LibreOffice version 7.6.1.2(x86_64) on Windows 10
I use the following:
func getFileName
sUrl = ThisComponent.getURL()
sFullPath = ConvertFromURL(sUrl)
sFileName = Regex(sFullPath;"[^\]*$")
msgbox(sFileName & Chr$(13) & filename)
end func
No matter what I do the function keeps returning an error "Sub procedure or function procedure not defined.
If I leave out the quote in the regex definition I get the error “Unexpected symbol ^\”
The regex command [^\]*$ works. I tested it using search & replace in Writer where I inserted a full path to a file. The search highlights the file name correctly. And I tested it at https://regex101.com/. with a full path file statement.
I’m open to an easier way to get the file name into a variable.
John in Oregon USA