quick one...
-
im trying to change (in multiple files)
NAME=there is Multiple Words here
NAME=tacoto
NAME=There Is Multiple Words Here
NAME=Tacoproblem is, there are also DEFNAME= lines (which i dont want) and of the lines
(i can always go back and change the of the later)so for search i got
^NAME=(.*)$but how do first letter capitilize the words after that? sometimes its 1 word, sometimes its 2 3 4 5 words…
for replace i tried
NAME=\u$1but that only does the first word in the string…
how would you do every word after the NAME= part?
-
@x-77-x ,
If I were trying to solve this for myself, I’d probably go to the Generic Regular Expression FAQ and try Replace in a Specific Zone of Text.
As long as
there is Multiple Words here
is all on a single line (you originally saidMultiple Lines
, which worried me; I’m glad you changed it), then the beginning-of-region expression (the BSR term) would be^NAME=
, and you would want to search for whole words, which are\b\w+\b
; the replacement would be\u$0
. You would plug those into the single-line version of the formula -
im confused… hmmm
i was able to bookmark all the NAME= lines with ^NAME=(.*)$
is there a way to use the EDIT - CONVERT CASE TO on only the marked lines?
i could always go back a second time and change the Name= back to NAME=
-
@x-77-x said in quick one...:
im confused… hmmm
I’m confused too, because the FAQ explains what to do, and when I followed the instructions in the FAQ, it transformed your example data as you requested. (yes, I had a mistake in the URL for the second, sending you to the first page again, but if you couldn’t figure out from there what to click, then you need to try again… and i’ve fixed the link)
If the regex you derived from the formula in that Specific Zone of Text one-line formula doesn’t work, show us exactly what you tried, because it worked for me.
-
@x-77-x said in quick one...:
i was able to bookmark
In your first post you referred to “Replace” suggesting you were using the Replace function. In your second post you refer to “bookmark”. Why the change? The supplied solution is using the Replace function which you first referred to.
Terry
-
@Terry-R just suggesting a different route, i dont understand what peter is talking about (too advanced for me), im a Noob so all i use is…
Find In Files/Replace
Find what:
Replace with:and thats about it
so i thought maybe i could bookmark the lines then use the convert case instead
-
@x-77-x said in quick one...:
i dont understand what peter is talking about
Sorry, given the proficiency that your original regex showed, I had hoped that you would understand my pointers.
The FAQ gives the following formula for replacing within a zone of text on one line – it was meant as a “fill in the blank” so that you could use the formula even if you don’t understand the syntax used:
SEARCH
(?-s)(?-i:
BSR|(?!\A)\G).*?\K(?-i:
FR)
REPLACE RRThe FAQ also explained what BSR and FR meant.
I also told you that BSR for your case was
^NAME=
and that what you wanted to match was\b\w+\b
(sorry, I thought I had told you that was FR, but apparently didn’t type that part), and that your replacement should be\u$0
Thus, you should try SEARCH =
(?-s)(?-i:^NAME=|(?!\A)\G).*?\K(?-i:\b\w+\b)
and REPLACE =\u$0
… At least, that worked for me given your example data.