Change a line..



  • Have tried and tried but can’t get it to work…

    This is what I have: title = AIGAIM_Air Busan Airbus A321-200SL ; Variation name

    I want to change to this: title = "AIGAIM_Air Busan Airbus A321-200SL ; "

    Any help appreciated…have to do a couple thousand times…lol

    Bob M.



  • @Carolina-Number-1 said in Change a line..:

    Have tried and tried but can’t get it to work…

    Exactly what have you tried?
    Seeing what you’ve done and allowing us to comment on it, helps the learning process, for repeat data-manipulation question askers.



  • title = “AIGAIM_Airblue Airbus A321-200SL ; Variation name”

    title = "${1} ; "

    I had this from before but want to have it like this… (I was screwing around and couldn’t get it right so this is a fresh sample…regular expression

    Thanks !!



  • @Carolina-Number-1

    I’m confused by your example.
    I think you need to better identify what you searched for and what you replaced with. Something like:

    find: I searched for this
    replace: I replaced with this



  • @Alan-Kilborn

    I search for this: title = “AIGAIM_Airblue Airbus A321-200SL ; Variation name”
    I replaced with this; title = "AIGAIM_Airblue Airbus A321-200SL ; "

    will that work: I am wanting to run an “expression” that will change the search to the replace? Begins with title on both search and replace. I am basically changing the title line for both lines.

    Does that work Alan?

    Bestest,
    BobM.



  • @Carolina-Number-1 ,

    In your first post, you said

    This is what I have: title = AIGAIM_Air Busan Airbus A321-200SL ; Variation name
    I want to change to this: title = "AIGAIM_Air Busan Airbus A321-200SL ; "

    In your next

    title = “AIGAIM_Airblue Airbus A321-200SL ; Variation name”
    title = "${1} ; "

    and in your third, you went back to

    I search for this: title = “AIGAIM_Airblue Airbus A321-200SL ; Variation name”
    I replaced with this; title = "AIGAIM_Airblue Airbus A321-200SL ; "

    Does that really seem to you to be adequate clarification? What new information do you think you shared in the third that you hadn’t already shared?

    Read and understand the advice below, and try again.

    ----

    Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as literal text using the </> toolbar button or manual Markdown syntax.

    To make regex in red (and so they keep their special characters like *), use backticks, like `^.*?blah.*?\z`. Screenshots can be pasted from the clipboard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get. Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.



  • This post is deleted!


  • @PeterJones @Alan-Kilborn

    Thank you… I will read this and try to figure this out…

    Bestest!!

    BobM.



  • @Carolina-Number-1 quoted from @Alan-Kilborn’s post from “Paste every “say 37th line” apx…”, where extended mode was recommended, then asked


    Alan: If i go back to this; will this be ok…

    … then deleted that message while I was starting to reply …

    You can use extended mode to do some replacements, as long as the fancy characters you are looking for only involve newlines (\r\n), tabs, etc. But since you seem to be wanting to do partial replacement, I don’t think that “extended” will be sufficient

    Since there were like 30 posts the last time, and to prevent so much back and forth, I’m going to try to read your mind.

    I mind-read that you have data like

    title = AIGAIM_Air Busan Airbus A321-200SL ; Variation name
    some other rows
    Variation name might appear elsewhere
    
    title = AIGAIM_Thai VietJet Air Airbus A320-200 ; Variation name
    blah
    

    and you want to look for any of the “title” lines, and remove just the “Variation name” portion, so that it will end up like

    title = AIGAIM_Air Busan Airbus A321-200SL ;
    some other rows
    Variation name might appear elsewhere
    
    title = AIGAIM_Thai VietJet Air Airbus A320-200 ;
    blah
    

    (Do you see how much easier it is to see the “before” and “after” when you actually show it, in the </> text boxes?!)

    Now you can fill out the Replace dialog like:

    • Find What = (?-is)^(title = .*?;) Variation name
    • Replace With = ${1}
    • Search Mode = regular expression

    881de85a-cdd9-491d-9eab-43064c0cd73b-image.png

    If this is not sufficient, you will have to do a better job of clarifying if you want any more help.



  • I am 70…having one of those days…I am basically just changing the title line for whatever is on the line .

    I think the search line (Find what) is right…I will add a " next to Variation name"
    and the replace will be removing variation name and add a " to the title line.

    The info on the title line is for hundreds and thousands of different AIGAIM _ names.

    Thanks, @PeterJones

    BobM

    PS Are you and Alan developers of this great program and if so…where can I donate… You guys are wonderful to put up with some real winners…lol



  • @Carolina-Number-1 said in Change a line..:

    and the replace will be removing variation name and add a " to the title line.

    I didn’t notice that in the first data.

    • Find what = (?-is)^(title = )(.*?); Variation name
    • Replace with = ${1}"${2}";

    I put the prefix in group 1, and the title value in group 2. In the replacement, I put the quotes around the title value.

    Are you and Alan developers of this great program

    Neither he nor I are frequent contributors to the codebase. We “pay it back” by answering questions and helping others here. :-)

    where can I donate

    http://notepad-plus-plus.org/donate/ is the official donation page for the Notepad++



  • @PeterJones said in Change a line..:

    = ${1}"${2}";

    This worked like a charm:

    (?-is)^(title = )(.*?); Variation name"
    ${1}${2};"

    I think I can adapt it or tweak it if I need too.

    Thanks @PeterJones @Alan-Kilborn


Log in to reply