GREP style after double line break

Home Forums General InDesign Topics GREP style after double line break

Tagged: 

This topic contains 3 replies, has 3 voices, and was last updated by  Peter Kahrel 1 month ago.

  • Author
    Posts
  • #93806

    Jey Tee
    Member

    I would like to apply a GREP style to all words after a double line break (before the next line break). Basicly highlight all the titles in the document. What would be the code for that?

  • #93851

    I’m not a GREP expert, but I think the pattern for your GREP Style would be

    APPLY:
    Bold [character style selected from menu]

    TO TEXT:
    Line break, Line break, Any character repeated one or more times, Line break

    which in GREP-ese is \n\n.+\n

    I did a test over here and that seems to work. Does it for you?

  • #93852

    To be clear, this is what you’d edit in the *paragraph style’s* GREP Style panel. The paragraph style that you’ll be applying to the paragraphs containing all the titles.

    It’s not a GREP Find/Change … but the same codes could work there.

  • #93860

    Peter Kahrel
    Member

    GREP styles are defined inside a paragraph (or paragraph style). Which means that you’d first have to apply a paragraph style to those titles — in which case you don’t need a GREP style, you simply make the formatting part of the paragraph style. Also, Anne-Marie correctly wrote that you can look for \n, but that’s a forced line break. If those line breaks are paragraph breaks then you can’t use a GREP style.

    Why don’t you apply a paragraph style with a GREP find/change? Look for (?< =\r\r).+ and apply a paragraph style. And if you set space before in the paragraph style, you can remove those two line breaks (which you really should do): Find what: \r\r(.) Change to: $1 Change Format: </p> <p>Peter</p> </div><!-- .bbp-reply-content --> </div><!-- .reply --> </li> </li><!-- .bbp-body --> <li class="bbp-footer"> <div class="bbp-reply-author">Author</div> <div class="bbp-reply-content"> Posts </div><!-- .bbp-reply-content --> </li><!-- .bbp-footer --> </ul><!-- #topic-93806-replies --> <div class="bbp-pagination"> <div class="bbp-pagination-count"> </div> <div class="bbp-pagination-links"> </div> </div> <div id="no-reply-93806" class="bbp-no-reply"> <div class="bbp-template-notice"> <p>You must be logged in to reply to this topic.</p> </div> </div> </div> <div class="clear"></div> <p></p> </div> <div class="not_mobile"> <center><!-- IDS_728x90_forum_top --> <!-- IDS_728x90_forum_top --> <div id='div-gpt-ad-1380732526676-8' style='width:728px; height:90px;'> <script type='text/javascript'> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1380732526676-8'); }); </script> </div> </center> </div> </div> </div> </div> <div class="clear"></div> </div> <!-- close container --> <div class="footerwidgets"> <div class="row"> <div class="eight columns"> <div class="four columns"> <div id="nav_menu-2" class="widget widget_nav_menu"><h5>InDesign Secrets</h5><div class="menu-indesignsecrets-container"><ul id="menu-indesignsecrets" class="menu"><li id="menu-item-18240" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18240"><a href="https://indesignsecrets.com/about">About Us</a></li> <li id="menu-item-18241" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18241"><a href="https://indesignsecrets.com/contact">Contact Us</a></li> <li id="menu-item-18301" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18301"><a href="https://indesignsecrets.com/write-for-us">Write for Us</a></li> <li id="menu-item-18300" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18300"><a href="https://indesignsecrets.com/speak-at-our-events">Speak at Our Events</a></li> <li id="menu-item-18242" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18242"><a href="https://indesignsecrets.com/advertise">Advertise</a></li> <li id="menu-item-18243" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18243"><a href="https://indesignsecrets.com/privacy-policy">Privacy Policy</a></li> <li id="menu-item-18244" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18244"><a href="https://indesignsecrets.com/useragreement">Terms of Use</a></li> </ul></div></div><div id="nav_menu-3" class="widget widget_nav_menu"><h5>CreativePro Week 2017</h5><div class="menu-creativepro-week-2017-container"><ul id="menu-creativepro-week-2017" class="menu"><li id="menu-item-18024" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18024"><a target="_blank" href="http://creativeproweek.com">Conference Site</a></li> <li id="menu-item-18025" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18025"><a target="_blank" href="http://creativeproweek.com/atlanta-2017/register-now/">Register Now</a></li> <li id="menu-item-18026" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18026"><a target="_blank" href="http://creativeproweek.com/atlanta-2017/speakers">Speakers</a></li> <li id="menu-item-18027" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18027"><a target="_blank" href="http://creativeproweek.com/atlanta-2017/the-indesign-conference/">The InDesign Conference</a></li> <li id="menu-item-18030" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18030"><a target="_blank" href="http://conference.creativepro.com/docs/CreativePro2017_ConvinceYourBoss.pdf">PDF Brochure</a></li> </ul></div></div> </div> <div class="four columns"> <div id="nav_menu-4" class="widget widget_nav_menu"><h5>About the Site</h5><div class="menu-about-the-site-container"><ul id="menu-about-the-site" class="menu"><li id="menu-item-18310" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18310"><a href="https://indesignsecrets.com/archive">Blog Archives</a></li> <li id="menu-item-73972" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-73972"><a href="https://indesignsecrets.com/membership">Membership</a></li> <li id="menu-item-18015" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18015"><a href="http://indesignsecrets.com/forums">Forums</a></li> <li id="menu-item-18250" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-18250"><a href="https://indesignsecrets.com/resources/faq">InDesign FAQ</a></li> </ul></div></div><div id="nav_menu-5" class="widget widget_nav_menu"><h5>Podcast</h5></div> </div> <div class="four columns"> <div id="nav_menu-6" class="widget widget_nav_menu"><h5>Resources</h5><div class="menu-resources-container"><ul id="menu-resources" class="menu"><li id="menu-item-18037" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18037"><a href="http://indesignsecrets.com/resources/books-and-videos">Books and Videos</a></li> <li id="menu-item-18036" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18036"><a href="http://indesignsecrets.com/events/">Events</a></li> <li id="menu-item-18038" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18038"><a href="http://indesignsecrets.com/issues">InDesign Magazine</a></li> <li id="menu-item-18039" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18039"><a href="http://indesignsecrets.com/shop">Store</a></li> <li id="menu-item-18040" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18040"><a href="http://indesignsecrets.com/resources/training-and-consulting">Training & Consulting</a></li> </ul></div></div> </div> </div> <div class="four columns footer_right"> <div id="widget_sp_image-4" class="widget widget_sp_image"><a href="http://indesignsecrets.com/how-to-find-things-here" target="_self" class="widget_sp_image-image-link" title=""><img width="216" height="145" alt="" class="attachment-full aligncenter" style="max-width: 216px;max-height: 145px;" src="https://indesignsecrets.com/wp-content/uploads/2013/04/how_to_find.png" /></a><div class="widget_sp_image-description" ><p><a href="http://indesignsecrets.com/how-to-find-things-here">Our guide to discovering all the<br /> great resources on the site!</a></p> </div></div><div id="text-4" class="widget widget_text"><h4>Get in Touch</h4> <div class="textwidget"><a href="mailto:info@indesignsecrets.com">info [at] indesignsecrets.com</a> <a href="https://twitter.com/indesignsecrets" target="_blank">Twitter: @InDesignSecrets</a> <a href="https://www.facebook.com/indesignsecrets" target="_blank">Facebook: InDesignSecrets</a></div> </div> </div> </div> </div> <div class="footer"> <div class="row"> <div class="twelve columns"> <div class="footerleft"> <ul class="socials"> <li class="copy">Follow Us!</li><li><a class="facebook" href="https://www.facebook.com/indesignsecrets" title="Facebook" target="_blank"></a></li><li><a class="twitter" href="https://twitter.com/indesignsecrets" title="Twitter" target="_blank"></a></li><li><a class="gplus" href="https://plus.google.com/114942883870244525254/posts" title="Google Plus" target="_blank"></a></li><li><a class="youtube" href="http://www.youtube.com/results?search_query=indesignsecrets" title="YouTube" target="_blank"></a></li><li><a class="mp3" href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=101102043" title="Subscribe" target="_blank"></a></li> </ul> </div> <!-- END .footerleft --> <div class="footerright"> <div class='gf_browser_unknown gform_wrapper' id='gform_wrapper_1' ><form method='post' enctype='multipart/form-data' target='gform_ajax_frame_1' id='gform_1' action='/topic/grep-style-after-double-line-break'> <div class='gform_heading'> <span class='gform_description'>Put InDesignSecrets in your InBox: </span> </div> <div class='gform_body'><ul id='gform_fields_1' class='gform_fields top_label form_sublabel_below description_below'><li id='field_1_1' class='gfield gplaceholder gfield_contains_required field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_1_1' >Your email address for newsletter...<span class='gfield_required'>*</span></label><div class='ginput_container ginput_container_email'> <input name='input_1' id='input_1_1' type='text' value='' class='large' /> </div></li> </ul></div> <div class='gform_footer top_label'> <input type='submit' id='gform_submit_button_1' class='gform_button button' value='Go' onclick='if(window["gf_submitting_1"]){return false;} window["gf_submitting_1"]=true; ' onkeypress='if( event.keyCode == 13 ){ if(window["gf_submitting_1"]){return false;} window["gf_submitting_1"]=true; jQuery("#gform_1").trigger("submit",[true]); }' /> <input type='hidden' name='gform_ajax' value='form_id=1&title=&description=1&tabindex=0' /> <input type='hidden' class='gform_hidden' name='is_submit_1' value='1' /> <input type='hidden' class='gform_hidden' name='gform_submit' value='1' /> <input type='hidden' class='gform_hidden' name='gform_unique_id' value='' /> <input type='hidden' class='gform_hidden' name='state_1' value='WyJbXSIsIjM4MDc5ZWE5NmRhZjgxMzBiOTU4ODVkZGY2NzFhMzYzIl0=' /> <input type='hidden' class='gform_hidden' name='gform_target_page_number_1' id='gform_target_page_number_1' value='0' /> <input type='hidden' class='gform_hidden' name='gform_source_page_number_1' id='gform_source_page_number_1' value='1' /> <input type='hidden' name='gform_field_values' value='' /> </div> </form> </div> <iframe style='display:none;width:0px;height:0px;' src='about:blank' name='gform_ajax_frame_1' id='gform_ajax_frame_1'>This iframe contains the logic required to handle AJAX powered Gravity Forms.</iframe> <script type='text/javascript'>jQuery(document).ready(function($){gformInitSpinner( 1, 'https://indesignsecrets.com/wp-content/plugins/gravityforms/images/spinner.gif' );jQuery('#gform_ajax_frame_1').load( function(){var contents = jQuery(this).contents().find('*').html();var is_postback = contents.indexOf('GF_AJAX_POSTBACK') >= 0;if(!is_postback){return;}var form_content = jQuery(this).contents().find('#gform_wrapper_1');var is_confirmation = jQuery(this).contents().find('#gform_confirmation_wrapper_1').length > 0;var is_redirect = contents.indexOf('gformRedirect(){') >= 0;var is_form = form_content.length > 0 && ! is_redirect && ! is_confirmation;if(is_form){jQuery('#gform_wrapper_1').html(form_content.html());if(form_content.hasClass('gform_validation_error')){jQuery('#gform_wrapper_1').addClass('gform_validation_error');} else {jQuery('#gform_wrapper_1').removeClass('gform_validation_error');}setTimeout( function() { /* delay the scroll by 50 milliseconds to fix a bug in chrome */ }, 50 );if(window['gformInitDatepicker']) {gformInitDatepicker();}if(window['gformInitPriceFields']) {gformInitPriceFields();}var current_page = jQuery('#gform_source_page_number_1').val();gformInitSpinner( 1, 'https://indesignsecrets.com/wp-content/plugins/gravityforms/images/spinner.gif' );jQuery(document).trigger('gform_page_loaded', [1, current_page]);window['gf_submitting_1'] = false;}else if(!is_redirect){var confirmation_content = jQuery(this).contents().find('#gforms_confirmation_message_1').html();if(!confirmation_content){confirmation_content = contents;}setTimeout(function(){jQuery('#gform_wrapper_1').replaceWith('<' + 'div id=\'gforms_confirmation_message_1\' class=\'gform_confirmation_message_1 gforms_confirmation_message\'' + '>' + confirmation_content + '<' + '/div' + '>');jQuery(document).trigger('gform_confirmation_loaded', [1]);window['gf_submitting_1'] = false;}, 50);}else{jQuery('#gform_1').append(contents);if(window['gformRedirect']) {gformRedirect();}}jQuery(document).trigger('gform_post_render', [1, current_page]);} );} );</script><script type='text/javascript'> if(typeof gf_global == 'undefined') var gf_global = {"gf_currency_config":{"name":"U.S. Dollar","symbol_left":"$","symbol_right":"","symbol_padding":"","thousand_separator":",","decimal_separator":".","decimals":2},"base_url":"https:\/\/indesignsecrets.com\/wp-content\/plugins\/gravityforms","number_formats":[],"spinnerUrl":"https:\/\/indesignsecrets.com\/wp-content\/plugins\/gravityforms\/images\/spinner.gif"};jQuery(document).bind('gform_post_render', function(event, formId, currentPage){if(formId == 1) {} } );jQuery(document).bind('gform_post_conditional_logic', function(event, formId, fields, isInit){} );</script><script type='text/javascript'> jQuery(document).ready(function(){jQuery(document).trigger('gform_post_render', [1, 1]) } ); </script> </div> </div> </div> <p class="copyright"> © 2006 - 2017 Creative Publishing Network Inc. All Rights Reserved </p> </div> <!-- close container --> <!-- This site is converting visitors into subscribers and customers with OptinMonster - http://optinmonster.com :: Campaign Title: IDS bigger --><div id="om-vczwm2qdcea82jc7-holder"></div><script>var vczwm2qdcea82jc7,vczwm2qdcea82jc7_poll=function(){var r=0;return function(n,l){clearInterval(r),r=setInterval(n,l)}}();!function(e,t,n){if(e.getElementById(n)){vczwm2qdcea82jc7_poll(function(){if(window['om_loaded']){if(!vczwm2qdcea82jc7){vczwm2qdcea82jc7=new OptinMonsterApp();return vczwm2qdcea82jc7.init({"u":"7226.279456","staging":0,"dev":0,"beta":0});}}},25);return;}var d=false,o=e.createElement(t);o.id=n,o.src="//a.optnmstr.com/app/js/api.min.js",o.async=true,o.onload=o.onreadystatechange=function(){if(!d){if(!this.readyState||this.readyState==="loaded"||this.readyState==="complete"){try{d=om_loaded=true;vczwm2qdcea82jc7=new OptinMonsterApp();vczwm2qdcea82jc7.init({"u":"7226.279456","staging":0,"dev":0,"beta":0});o.onload=o.onreadystatechange=null;}catch(t){}}}};(document.getElementsByTagName("head")[0]||document.documentElement).appendChild(o)}(document,"script","omapi-script");</script><!-- / OptinMonster --> <script type="text/javascript">var vczwm2qdcea82jc7_shortcode = true;</script> <script type="text/javascript"> jQuery(document).ready(function($) { $("#rotator").cycle({ fx: 'fade', timeout: 3000, speed: 1000, pause: 1, fit: 1 }); }); </script> <link rel='stylesheet' id='gravityformsmailchimp_form_settings-css' href='https://indesignsecrets.com/wp-content/plugins/gravityformsmailchimp/css/form_settings.css?ver=4.1' type='text/css' media='all' /> <script type='text/javascript' src='https://indesignsecrets.com/wp-includes/js/comment-reply.min.js?ver=4.7.5'></script> <script type='text/javascript'> /* <![CDATA[ */ var bbpTopicJS = {"bbp_ajaxurl":"https:\/\/indesignsecrets.com\/topic\/grep-style-after-double-line-break\/?bbp-ajax=true","generic_ajax_error":"Something went wrong. Refresh your browser and try again.","is_user_logged_in":"","fav_nonce":"70e0284867","subs_nonce":"fc9516ec87"}; /* ]]> */ </script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/plugins/bbpress/templates/default/js/topic.js?ver=2.5.12-6148'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/plugins/bbpress/templates/default/js/reply.js?ver=2.5.12-6148'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/themes/indesign_secrets/js/jquery.lazyload-ad-1.4.2-min.js?ver=1.0'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/themes/indesign_secrets/js/superfish.js?ver=1.0'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/themes/indesign_secrets/js/jquery.flexslider.js?ver=1.6.2'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/themes/indesign_secrets/js/jquery.fitVids.js?ver=4.7.5'></script> <script type='text/javascript'> /* <![CDATA[ */ var ajax_info = {"site_url":"https:\/\/indesignsecrets.com"}; /* ]]> */ </script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/themes/indesign_secrets/js/custom.js?ver=4.7.5'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/themes/indesign_secrets/js/jquery.jplayer.min.js?ver=4.7.5'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/plugins/wp-cycle/jquery.cycle.all.min.js?ver=2.9999.5'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-includes/js/wp-embed.min.js?ver=4.7.5'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/plugins/gravityforms/js/jquery.json.min.js?ver=2.1.2'></script> <script type='text/javascript' src='https://indesignsecrets.com/wp-content/plugins/gravityforms/js/gravityforms.min.js?ver=2.1.2'></script> <script type="text/javascript">var omapi_localized = { ajax: 'https://indesignsecrets.com/wp-admin/admin-ajax.php?optin-monster-ajax-route=1', nonce: 'e8ee6aae7e' };</script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-4836288-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <div class="remarketing_code"> <!-- Google Code for Remarketing Tag --> <!-------------------------------------------------- Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup ----------------------------------------------------> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 935510163; var google_custom_params = window.google_tag_params; var google_remarketing_only = true; /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/935510163/?value=0&guid=ON&script=0"/> </div> </noscript> </div> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=246727095428680"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <!-- Twitter universal website tag code --> <script> !function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments); },s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='//static.ads-twitter.com/uwt.js', a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script'); // Insert Twitter Pixel ID and Standard Event data below twq('init','nw53q'); twq('track','PageView'); </script> <!-- End Twitter universal website tag code --> <!-- Facebook Pixel Code --> <script> !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window,document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '1098614176861033'); fbq('track', 'PageView'); </script> <noscript> <img height="1" width="1" src="https://www.facebook.com/tr?id=1098614176861033&ev=PageView &noscript=1"/> </noscript> <!-- End Facebook Pixel Code --> </body> </html>