Using regular expressions via `re-search-forward` in elisp [duplicate]












0
















This question already has an answer here:




  • Emacs - regular expressions in Lisp need to be double-escaped - why?

    4 answers




I want to search for an regular expression with the function re-search-forward



When I tried using the examples from the page
here: https://www.emacswiki.org/emacs/RegularExpression#toc1



specifically the regular expression w{20,} used to search for a word with 20 letters or more, I get an error.



Here I am placing my cursor after the closing parenthesis in my Lisp buffer and pressing C-x C-e for evaluating it.



However, when I use the Regexp I-search via,
C-M-s it highlights the correct word as expected.



Why is this?



enter image description hereenter image description here










share|improve this question













marked as duplicate by phils elisp
Users with the  elisp badge can single-handedly close elisp questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 18 '18 at 5:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




















    0
















    This question already has an answer here:




    • Emacs - regular expressions in Lisp need to be double-escaped - why?

      4 answers




    I want to search for an regular expression with the function re-search-forward



    When I tried using the examples from the page
    here: https://www.emacswiki.org/emacs/RegularExpression#toc1



    specifically the regular expression w{20,} used to search for a word with 20 letters or more, I get an error.



    Here I am placing my cursor after the closing parenthesis in my Lisp buffer and pressing C-x C-e for evaluating it.



    However, when I use the Regexp I-search via,
    C-M-s it highlights the correct word as expected.



    Why is this?



    enter image description hereenter image description here










    share|improve this question













    marked as duplicate by phils elisp
    Users with the  elisp badge can single-handedly close elisp questions as duplicates and reopen them as needed.

    StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function() {
    $hover.showInfoMessage('', {
    messageElement: $msg.clone().show(),
    transient: false,
    position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
    dismissable: false,
    relativeToBody: true
    });
    },
    function() {
    StackExchange.helpers.removeMessages();
    }
    );
    });
    });
    Nov 18 '18 at 5:35


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


















      0












      0








      0









      This question already has an answer here:




      • Emacs - regular expressions in Lisp need to be double-escaped - why?

        4 answers




      I want to search for an regular expression with the function re-search-forward



      When I tried using the examples from the page
      here: https://www.emacswiki.org/emacs/RegularExpression#toc1



      specifically the regular expression w{20,} used to search for a word with 20 letters or more, I get an error.



      Here I am placing my cursor after the closing parenthesis in my Lisp buffer and pressing C-x C-e for evaluating it.



      However, when I use the Regexp I-search via,
      C-M-s it highlights the correct word as expected.



      Why is this?



      enter image description hereenter image description here










      share|improve this question















      This question already has an answer here:




      • Emacs - regular expressions in Lisp need to be double-escaped - why?

        4 answers




      I want to search for an regular expression with the function re-search-forward



      When I tried using the examples from the page
      here: https://www.emacswiki.org/emacs/RegularExpression#toc1



      specifically the regular expression w{20,} used to search for a word with 20 letters or more, I get an error.



      Here I am placing my cursor after the closing parenthesis in my Lisp buffer and pressing C-x C-e for evaluating it.



      However, when I use the Regexp I-search via,
      C-M-s it highlights the correct word as expected.



      Why is this?



      enter image description hereenter image description here





      This question already has an answer here:




      • Emacs - regular expressions in Lisp need to be double-escaped - why?

        4 answers








      elisp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 18 '18 at 2:51









      smilingbuddhasmilingbuddha

      5,5072184142




      5,5072184142




      marked as duplicate by phils elisp
      Users with the  elisp badge can single-handedly close elisp questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 18 '18 at 5:35


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by phils elisp
      Users with the  elisp badge can single-handedly close elisp questions as duplicates and reopen them as needed.

      StackExchange.ready(function() {
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function() {
      $hover.showInfoMessage('', {
      messageElement: $msg.clone().show(),
      transient: false,
      position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
      dismissable: false,
      relativeToBody: true
      });
      },
      function() {
      StackExchange.helpers.removeMessages();
      }
      );
      });
      });
      Nov 18 '18 at 5:35


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          3














          This regexp:



          w{20,}


          is expressed in a double-quoted elisp string like so:



          "\w\{20,\}"


          Backslashes are special to the double-quoted read syntax for strings as well as being special to regexp syntax; so if a backslash is for the regexp, you need to double it.






          share|improve this answer
























          • Notice also how, in the screenshots in the question, the incorrect singular backslashes are coloured red? That is Emacs (26+) telling you that they are probably a mistake.

            – phils
            Nov 23 '18 at 22:29


















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          This regexp:



          w{20,}


          is expressed in a double-quoted elisp string like so:



          "\w\{20,\}"


          Backslashes are special to the double-quoted read syntax for strings as well as being special to regexp syntax; so if a backslash is for the regexp, you need to double it.






          share|improve this answer
























          • Notice also how, in the screenshots in the question, the incorrect singular backslashes are coloured red? That is Emacs (26+) telling you that they are probably a mistake.

            – phils
            Nov 23 '18 at 22:29
















          3














          This regexp:



          w{20,}


          is expressed in a double-quoted elisp string like so:



          "\w\{20,\}"


          Backslashes are special to the double-quoted read syntax for strings as well as being special to regexp syntax; so if a backslash is for the regexp, you need to double it.






          share|improve this answer
























          • Notice also how, in the screenshots in the question, the incorrect singular backslashes are coloured red? That is Emacs (26+) telling you that they are probably a mistake.

            – phils
            Nov 23 '18 at 22:29














          3












          3








          3







          This regexp:



          w{20,}


          is expressed in a double-quoted elisp string like so:



          "\w\{20,\}"


          Backslashes are special to the double-quoted read syntax for strings as well as being special to regexp syntax; so if a backslash is for the regexp, you need to double it.






          share|improve this answer













          This regexp:



          w{20,}


          is expressed in a double-quoted elisp string like so:



          "\w\{20,\}"


          Backslashes are special to the double-quoted read syntax for strings as well as being special to regexp syntax; so if a backslash is for the regexp, you need to double it.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 18 '18 at 5:33









          philsphils

          57.8k7109142




          57.8k7109142













          • Notice also how, in the screenshots in the question, the incorrect singular backslashes are coloured red? That is Emacs (26+) telling you that they are probably a mistake.

            – phils
            Nov 23 '18 at 22:29



















          • Notice also how, in the screenshots in the question, the incorrect singular backslashes are coloured red? That is Emacs (26+) telling you that they are probably a mistake.

            – phils
            Nov 23 '18 at 22:29

















          Notice also how, in the screenshots in the question, the incorrect singular backslashes are coloured red? That is Emacs (26+) telling you that they are probably a mistake.

          – phils
          Nov 23 '18 at 22:29





          Notice also how, in the screenshots in the question, the incorrect singular backslashes are coloured red? That is Emacs (26+) telling you that they are probably a mistake.

          – phils
          Nov 23 '18 at 22:29



          Popular posts from this blog

          鏡平學校

          ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

          Why https connections are so slow when debugging (stepping over) in Java?