I need to add some code at the end of some lines :



  • I need to add " </strong><br /> " at the end of "<p><strong>Loremipsum2 " like the first line
    My file :
    <p><strong>Loremipsum1 </strong><br />
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    <p><strong>Loremipsum2
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.



  • @oumal-bana ,

    And why is this causing you difficulty?

    • Search > Replace
    • FIND WHAT = <p><strong>Loremipsum2
    • REPLACE WITH = <p><strong>Loremipsum2 </strong><br />
    • SEARCH MODE = Normal (the default, if you haven’t previously changed this)
    • FIND NEXT
    • REPLACE (or REPLACE ALL)

    To do what you described doesn’t take any fancy search mode (like regular expression) or any knowledge beyond basic search-and-replace actions, which are common to every editor I’ve used.

    My incredulity at the question leads me to believe that you have actually not correctly described your circumstances: for example, maybe when you wrote Loremipsum2, it wasn’t meant as literal text, but was meant to indicate “some random text goes here, and it might differ from paragraph to paragraph”; if that’s the case, then that changes things, and you should have said so to begin with.

    ----

    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.



  • Hi, thanks for the reply.
    Yes the “Loremipsum2” can be a random text. The only thing I have is, the lign starting with “<p><strong>”



  • @oumal-bana

    You still aren’t being very clear.

    If you want to transform this:

    <p><strong>Loremipsum1
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    <p><strong>Loremipsum2
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    

    into this:

    <p><strong>Loremipsum1</strong><br />
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    <p><strong>Loremipsum2</strong><br />
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    

    You could search for (?-s)^<p><strong>.* and replace with ${0}</strong><br />


Log in to reply