Quote:
Originally Posted by crnirg
Why does UK appear twice?
Search mode: Regular...
Search field: author
Search for: (.*)
Replace with: UK
Destination field: authors
Mode: Append ti field
check - Split result
check - Case sensitive
-------------------------
author before : Juli Zeh
author after: Juli Zeh & UKUK
|
I tried with an author with a 'one-word name', one with an author with a 'two-word name', and with an author with a 'three-word name'. In all cases they want to append 'UKUK'.
At a guess, it's returning 'UKUK' because it sees the 'real string' and an 'empty string' (perhaps picking up the start or end of the string as a matching substring). When you have '.+' it can't match the empty string, so you get only a single 'UK'.
Still, when using regex to append or prepend a string to a field like this, I prefer to use the string-start and string-end special characters ('^' and '$' respectively) or to explicitly replace the entire thing, which looks like
Search: ^(.*)$
Replace: \1 UK
The search here says 'replace all characters' -- '(.*)' alone says 'replace any string of 0 or more characters, '^(.*)$' says 'replace the entire string' -- with 'those characters + " UK"'.