Generic, RegEx Find & Replace Help Needed

I'm in a time CAP and need some advice. I want to understand RegEx, but right now need a quick fix.

I have a HUGE body of code that has a type of paragraph repeating everywhere, different contents in each particular case. I need to treat these paragraphs stand out by adding a rule above and below the surrounding text. The above rule is obvious, because of the class, this is the unique identifier for the paragraph, so I have to use for the weaker rule as well. I insert a string after the closing < /p > tag of each paragraph. I need a generic configuration that will escape the contents variable of all these paragraphs, but leave them intact afterwards.

Let's say that this represents the structure of paragraph:

< class p = "para_PN" > PN: [content Variable] < /p >

That's what I have to do to move on hundreds of cases:

< class p = "para_PN" > PN: [content Variable] < /p > < p > [element added to all] < /p >

Is the closest, I came:

To find:

< class p = "para_PN" > ([^ <] *) < /p >

Replace with:

< class p = "para_PN" >$ 1 < /p > < p > [element added to all] < /p >

But it stores the data for the first wildcard and stops later. Apparently I need a $ 2, $ 3, etc. for each instance and it is not convenient... It is already too.

Any ideas or solutions would be appreciated.

Thank you!

Cayce

I'm not sure that I fully understand what you're trying to do. If it is to make these paragraphs are distinguished by adding a rule upper and lower, the simplest way to do so is with CSS:

{.para_PN}

border-top: 3px solid #000;

border-bottom: 3px solid #000;

}

However, if you want to add a text in a paragraph, it is the regular expression that you need:

(

[\w\W]+?

)

In replace with field:

$1

It is a new text.

When you click on replace all, Dreamweaver goes through paragraphs correspondents one at a time. $1 replaces the original paragraph, and then the new text is added.

Tags: Dreamweaver

Similar Questions

  • Find/replace help with generic numbers...

    Hello... I am looking for help with wildcards.

    I have a specific task to complete... I have to add dash & space in a space in a string of letters and characters...

    here

    221 Kbps - 00:28:34space dash space here47 MB - 44.1 kHz

    198 kbps - 01:27:43 41 MB - 44.1 kHz

    215 Kbps - 00:34:52 156 MB - 44.1 kHz

    225-14 Kbps: 32:00 54 Mb - 48 kHz

    If my finished text will look like this

    221 Kbps - 00:28:34 47Mb - 44.1 kHz

    198 kbps - 01:27:43 - 41 Mb - 44.1 kHz

    215 Kbps - 00:34:52 -156 MB - 44.1 kHz

    225-14 Kbps: 32:00 - 54 Mb - 48 kHz

    There are many variables the text - but I thought that maybe I could create a generic figure find/replace, based on the Mb of type bit, replacing the single space space hyphen space

    BUT

    I need to keep the numbers before the MB

    so my question - is it possible to KEEP the NUMBERS of GENERIC character?

    Thank you very much!

    If text is like that throughout, you could do a search for

    To find

    (\:\d\d)\s+(\d+Mb)

    Implement

    $1-$2

    Try it on a few see if it works.

  • Find/replace help-

    I need to remove everything after a specific character

    I got a list for an example like this:

    In a table...

    Test #3434

    Test #3434

    Test #3434

    Test #3434

    Test #3434

    Test #3434

    I need to remove #3434

    Find: #.

    Change:?

    Thank you!

    Styles grep can't add text or remove the text - it basically applies a character style to the text.

    You can do a search for replacement for

    GREP

    (?<>

    Implement

    leave blank

    If you want to "send" with a GREP style. You could make a character style can choose the color of the character to be None

    Then in the style use GREP (?.)<>

    And choose the character style.

    But this leaves the text where it is, just apply has no color so that you can't see.

  • GREP find/replace + paragraph Styles

    Hello

    I'm editing a long document and have benefited from the assistance of the community already, but being new GREP Style, find/replace, I need to ask for additional help.

    Below a screenshot of the script (original). Two blocks of text you see anticipated by the icons have have styles of different paragraphs. Icons are placed like custom glyphs.

    Now, the last line with C2, 9, 14,... is the target of this post. They are buses of London and I created a paragraph with another icon. The copy that I work with unfortunately is as you see. Buses will follow «;»

    Resulting to place a \r after the semicolon and assign the new paragraph style. The item to work with is (probably) the last "," before the registration of the bus. All entries have it in the same way, where a search/replace global grep should work fine.

    My attempts:

    I used of a previous debate (? < =------;)) [^ ;] + $ to match everything from the end until the last semicolon, but then I found the problem preserving the matched characters and placing \r (using the (? < =-;). start at the beginning and stops at each point comma + space)

    So question: how to stop at the first semicolon at the end and replace the space with \r to create a new paragraph?

    Then, it is two question :-)

    From my previous attempts, I noticed that when you replace the semicolon + space with \r, and change the style of paragraph at a time (from Rail to Bus) caused the Rail paragraph style change (logic) to the style of Bus. So I tried to say the paragraph style of the track "Following paragraph Style is style of Bus" (and not to change the paragraph style in find/replace), but in a way that no longer works.

    Second question is: given to split the find/replace in two steps, how then transform / apply to newly created paragraph the correct style of Bus?

    Thank you in advance for your valuable assistance. So far, the community has been great!

    Antonio

    Original

    Screen Shot 2016-07-12 at 22.32.23.png

    Result for

    Screen Shot 2016-07-12 at 22.54.51.png

    Hi Antonio,.

    If I understand correctly, in 2 regex [1 click play with Multi/find-replace our friend Martinho da Gloria]:

  • Need help with this find/replace Script.

    Hi I got this script from Loic.Aigon.  And I got it works for find/replace simple changes however I Cannon operate for several changes.

     function cb5CallBack(target) {
            var findProps, changeProps;
            
                findProps = {findWhat:"Distributed by ",}   
                  changeProps = { changeTo:"Distributed by. ",}
                findProps = {findWhat:"Distribué par ",}   
                  changeProps = { changeTo:"Distribué par. ",}
                findProps = {findWhat:"Distribuido por ",}    
                  changeProps = { changeTo:"Distribuido por. ",},
              
            RTXT(target, findProps, changeProps);   
            } 
    

    function RTXT(target, findProps, changeProps)
    {
    app.findChangeTextOptions.caseSensitive = true;
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.properties = findProps;
    app.changeTextPreferences.properties = changeProps;
    app.changeTextPreferences.properties = changeProps;
    target.changeText();
    }
    

    You must call the function RTXT repeatedly as well:

        var findProps, changeProps;

        findProps   = { findWhat:"Distributed by "};

        changeProps = { changeTo:"Distributed by. "};

        RTXT(target, findProps, changeProps);

        findProps   = { findWhat:"Distribué par "};

        changeProps = { changeTo:"Distribué par. "};

        RTXT(target, findProps, changeProps);

        findProps   = { findWhat:"Distribuido por "};

        changeProps = { changeTo:"Distribuido por. "};

        RTXT(target, findProps, changeProps);

  • Help with wildcards and find/replace

    I have indesign CS5 and I'm working on a document that contains a number of mathematical examples throughout these 9-1 = 8. The corrector said must change to be a space between each symbol figure and math at 9-1 = 8. How can I do this? When I go to find/replace, I have the option of wildcards in find, but not to replace it.

    The dashboard in these equations must also be changed to quadratins. How can I know indesign is any time sees such an equation, the dashboard must be changed? I don't want to just change all the dashes as I much dashes that need to stay.

    Try it on greep

    Search: (\d+)\-(\d+)\=(\d+)

    Change: $1 / $2 = $3

  • Need to find/replace anything within the parenthesis

    Hello

    I like to find/replace, and it's time! I have a piece every day of what I need to reformat. It's characters like < B > I can use easily my saved search/replace to remove, but I can't seem to find a way to remove or change "anything within a parenthesis opened and closed." Is that and I do not see it or will it take a script for this?

    If I could get more information than the way that you are looking to remove/change, which would be useful. However, if you want to change what is IN the use of parentheses THIS in GREP:

    (?<>

    If you want to change the bracket also PRESENT in GREP:

    \(.+?\)

    Be sure to use the GREP, its an easy thing to forget tab. Good luck!

  • Help with letters in find/replace

    Hiyis. I am trying to replace all instances of 'US' 'US', but when I type in find/replace, I get stuff like 'chat' highlighted. No way to specify simply WE capitalized on its own? Or do I have to go through and review each proposed amendment?

    Thanks tons!

    Click on the icons for the case-sensitive and whole word in the dialog box:

  • Partial HREF value of find/replace

    Hi all.

    I'm having a heckofa problem and was hoping that someone on these boards may be able to help.

    I have 1000s of links that I need to deal with, and I'm afraid to do it by hand. Many links are now bad links - and they are & quot; bad & quot; in a very predictable way, as they it comme ils l' appellent call contain & quot; PHP? title = & quot; -If I want to find the bad code link and simply remove the & lt; anchor & gt; tag and leave the text containing such what.

    My guess is that this should not be as difficult as it is, but I could be very wrong here.

    So, I did the following in the Find/Replace dialog box:

    Search: Specific tag
    Selected tag: has
    With attribute: HREF

    Here is where I get confused. The & quot; attribute & quot; option has & quot; =, & lt; & gt;! = & quot; as the optoins. So I tried the equality operator using two regular expressoins (* php\? title\ = *) and without regular expressions(php?title), but no matter what I do, no links are. I'm very new to regex so maybe my code here is maybe bad. I wish there was a & quot; container & quot; the option with exposed attribute, but there isn't.

    So: do one of the y ' All DW gurus have ideas on this subject? I'm pulling what I left aside during this little hair.

    Thank you
    Joe

    Hey there ' All:

    Sorry for the late reply.

    That did the trick! I really can't thank you all enough for taking the time to help me with this. I was really at a loss. I think it's clear I need to stop procrastinating and to learn more about regular expressions.

    Slightly OT: books that y ' All is recommended for learning regular expressions? The great oreilly one?

    Thanks again. I enjoyed all your help.

    Joe

  • Find/replace on the long list of addresses

    I hope someone can help here.  I have format it more 11 000 address for publication in the following ways:

    < < current format > >

    1803156, I MEAN FIRST OF ALL, ADDRESS 1, STE 1

    1803157, I MEAN FIRST OF ALL, ADDRESS 1, STE 1

    etc...

    < < need to replace the first comma and space with a tab > >

    1803156 LAST, FIRST, ADDRESS 1, STE 1

    1803157 LAST, FIRST, ADDRESS 1, STE 1

    etc...

    Can anyone think of an easy way to do this with find/replace or another method?

    Search: (?-s)^.+?\K,\h)

    Replace by: \t

  • Bug in find/replace - no work around ideas

    With the help of CC2015 on Yosemite.

    There seems to be a bug in find/replace.

    I have a text style in various paragraph styles. The problem is that I also get a lot of tab characters unwanted that I need to delete that are always before a newline (CR). Get rid of them seems simple enough that all I have to do is to find a tab followed by a CR and replace them with a CR. The problem is that when I do it, InDesign changes the paragraph style of the paragraph following the same style as the previous paragraph. Nothing in the find/replace includes anything in the next paragraph, so why should it end up being on? I think it is a bug

    I tried to do this in GREP and also the method of TEXT, and the result is the same. As such, I can't replace the unwanted tabs. The ideas people?

    It is not a bug. Do not delete the return, only the tab.

    Find \t$ should work, or \t(?=\r), but the latter won't find a rear tab in the last paragraph in a story that does not end in a hard return.

    You could do \t+$ or \t+(?=\r) to remove several tabs.

  • Find + replace empty editable content area

    Nice day

    I created an editable region in a model specially designed for the follow-up of the pixels that change from time to time, depending on the service provider we use for campaigns. That's what the code looks like:

    <!-InstanceBeginEditable name = 'followed'--> <! - InstanceEndEditable - >

    We need to update this empty region with content on several pages 300 +, but the base Find & Replace will do, as it is a region locked in the child page and so - I think - is not "findable". Aside from manually update each page with the tracking pixel (sigh!), there's an ACE in the leg of someone to help me speed up this task?

    Thanks in advance for any help.

    You are right that you can't do this with DW. Best bet is to find another utility to do so. Notepad ++ is an option

    How to "Find and replace" words in multiple files

  • I'm looking for links Hypertext in find/replace the dialogue (without applying a character style).

    I have 7000 hyperlinks in my document, with different character styles ("italic", "bold" and "italic +"BOLD""). I need to apply the blue color to each of them. If I ask a new character style "hyperlink" to all, I'll lose my formatting.

    Is there a way to find hyperlinks (for themselves, not their format) dialog find/replace in order to create and apply 4 different character styles ('hyperlink_regular', 'hyperlink_bold', 'hyperlink_italic' and ' hyperlink_bold + italic")?

    Sorry for my English, thanks for the help!

    Use Javascript!

    You can use this Javascript, for example. (Instructions on how to use a JavaScript in InDesign can be found elsewhere).

    blue = app.activeDocument.swatches.item("Blue");
    for (a=0; a
    

    Take care to provide the correct color swatch name in the first line.

  • Find/replace does not

    I'm on a Mac using 10.5.7 with Indesign Cs4

    I have a very big book, I'm working on and need to change a text header. When I use "Find/replace" he say "cannot find Match". I am looking for the document and decided to use a common word and I still get the same results. Any help would be appreciated as it is driving me crazy.

    It of just a hunch, but do you have anything in the box 'Find Format'?

  • Using find/replace to find empty cells in a table

    I'm working on several catalogues pages where we apply styles of our catalogues. The find/replace feature really helped do, but I can't seem to find a way to find an empty cell in a table to add a style to only the cells that are empty. If someone knows a way to do this, saving me a bunch of times and I would be very grateful!

    Hello

    With GREP, this regex can probably help you: (?-m) ^ $

Maybe you are looking for

  • I can't connect my music on all my devices

    I can't access my music on all of my devices.

  • How can I stop FireFox update?

    I'm a web developer. I need to keep several versions of the major browsers to test against. I maintain Mozilla 6 on my desk, but I intend to keep Mozilla 5 on my laptop and version 4 on a virtual computer. This morning Firefox on mt laptop computer u

  • 2012 shuffle headphones

    I can't find many cheap helmets for the 4th generation iPod shuffle on apple store, but I have found some great ones on eBay for the 2012 version. I would like to ask, if I get a helmet for the gen version 2012 4th can I use it for the 4th gen 2015,

  • XP CD is cracked, I can replace it without having to buy new?

    My xp 64 is cracked, how can I replace it without having to buy new?

  • Vista Service Pack 1 and 2 Microsoft Download page

    I'm trying to download Vista Service Packs for my brothers computer which is not online. The Microsoft site will not display the download page. Anyone know what is happening? There is no error code, just the page does load not or blocked os. I tried