No, that's not the meaning of [^ ]. The link I gave you for Regular Expressions is old, but the information there covers my regular expression.But can you spare this old Swede a minute or two just to explain why the RegExp doesn't recognize the first spaces in DD_MMMM_YYYY? I assume that [^ ] should find the first space.
([^ ]+ )([^ ]+ )([^ ]+ ).+The expression in parentheses means: find a non-space, the [^ ], 1 or more times, the +, then a space. So, the pattern is a string of non-spaces followed by a space to match the day of the month and its following space. This matching is repeated two more times for the month and the year. The parentheses capture those strings of text into variables $1, $2, and $3. Then .+ matches everything else so the RegEx will match the entire value of the cell. Since .+ was matched but not captured, the final part of the text (the day of the week and the time) is gone when the $1$2$3 replacement is done. In hindsight I should have used
([^ ]+ [^ ]+ [^ ]+).+since I don't need to do three captures, nor capture the space after the year. Then the replacement is just $1.
Agreed. The Wikipedia article for Regular expressions does a better job of explaining the important concepts, especialy sections POSIX basic and extended and Metacharacters in POSIX extended. But one has to be careful with regular expressions since there are multiple implementations of this idea which both extend and limit the basic concepts. The implementation of regular expressions has undergone several changes in OpenOffice. Current regular expressions in OpenOffice version 4 support many of the features of ICU regular expressions. I haven't seen any really good documentation from OpenOffice for the current implementation. The team just doesn't have the resources to create that. For the most part I stick to the basics. I believe that the regular expressions in this post have been supported for 40 years, perhaps 50 years, and thus pre-date OpenOffice by a decade or two.… tried to read the Help, but it's hard to understand.
Statistics: Posted by MrProgrammer — Sun Dec 29, 2024 1:41 am