elisp regular expression build problemRegular expression to match text within quotesTurn case sensitivity off in regular expression replacementProblem in writing regular expression for imenu-generic-expressionRegular expression matching group replacement not workingregular expression whole word replace, whitespace onlyHow to correctly write regular expression to match ASCII control charswhat does grave accent ` and aposrophe ' do in elisp regular expression?

Prove your innocence

Did the British navy fail to take into account the ballistics correction due to Coriolis force during WW1 Falkland Islands battle?

Is using a hyperlink to close a modal a poor design decision?

How to respectfully refuse to assist co-workers with IT issues?

Is “I am getting married with my sister” ambiguous?

Is for(( ... )) ... ; a valid shell syntax? In which shells?

Confirming resignation after resignation letter ripped up

Fried gnocchi with spinach, bacon, cream sauce in a single pan

What is the difference between Major and Minor Bug?

Does norwegian.no airline overbook flights?

Are the players on the same team as the DM?

Why did they avoid parodying Martian Manhunter?

Mathematical uses of string theory

Identify this sanskrit mantra?

Identify a problem where a potentially winning move draws because of the 50 move rule

Efficiently pathfinding many flocking enemies around obstacles

Can you upsert using Composite SObject Tree?

How to get the current pages Page Design in code

What to say to a student who has failed?

What is the history of the university asylum law?

Would it be possible to have a GMO that produces chocolate?

Why were the crew so desperate to catch Truman and return him to Seahaven?

Sci fi film similar to Village of the Damned

Is gzip atomic?



elisp regular expression build problem


Regular expression to match text within quotesTurn case sensitivity off in regular expression replacementProblem in writing regular expression for imenu-generic-expressionRegular expression matching group replacement not workingregular expression whole word replace, whitespace onlyHow to correctly write regular expression to match ASCII control charswhat does grave accent ` and aposrophe ' do in elisp regular expression?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I have the following line :



mod_name func_name /users/username/workspace/path_name/file.c 283


I wanted to capture the 3rd and 4th entry in this line, I am able
to do that using regular expressions like so:
^(?:S+s)2(S+) ([0-9]+)



How do I translate this into a lisp regex ? so that elisp functions can
understand. I couldn't use the above regex into re-builder within emacs. Says it is an invalid expression. What am I doing wrong ?










share|improve this question





















  • 1





    Different regex syntaxes compared

    – Gilles
    Aug 12 at 8:44


















2















I have the following line :



mod_name func_name /users/username/workspace/path_name/file.c 283


I wanted to capture the 3rd and 4th entry in this line, I am able
to do that using regular expressions like so:
^(?:S+s)2(S+) ([0-9]+)



How do I translate this into a lisp regex ? so that elisp functions can
understand. I couldn't use the above regex into re-builder within emacs. Says it is an invalid expression. What am I doing wrong ?










share|improve this question





















  • 1





    Different regex syntaxes compared

    – Gilles
    Aug 12 at 8:44














2












2








2


1






I have the following line :



mod_name func_name /users/username/workspace/path_name/file.c 283


I wanted to capture the 3rd and 4th entry in this line, I am able
to do that using regular expressions like so:
^(?:S+s)2(S+) ([0-9]+)



How do I translate this into a lisp regex ? so that elisp functions can
understand. I couldn't use the above regex into re-builder within emacs. Says it is an invalid expression. What am I doing wrong ?










share|improve this question
















I have the following line :



mod_name func_name /users/username/workspace/path_name/file.c 283


I wanted to capture the 3rd and 4th entry in this line, I am able
to do that using regular expressions like so:
^(?:S+s)2(S+) ([0-9]+)



How do I translate this into a lisp regex ? so that elisp functions can
understand. I couldn't use the above regex into re-builder within emacs. Says it is an invalid expression. What am I doing wrong ?







regular-expressions






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 12 at 0:15









Drew

50.9k4 gold badges65 silver badges114 bronze badges




50.9k4 gold badges65 silver badges114 bronze badges










asked Aug 11 at 19:35









maindoormaindoor

254 bronze badges




254 bronze badges










  • 1





    Different regex syntaxes compared

    – Gilles
    Aug 12 at 8:44













  • 1





    Different regex syntaxes compared

    – Gilles
    Aug 12 at 8:44








1




1





Different regex syntaxes compared

– Gilles
Aug 12 at 8:44






Different regex syntaxes compared

– Gilles
Aug 12 at 8:44











1 Answer
1






active

oldest

votes


















5















Emacs regexps do not use S or s for non-whitespace and whitepsace. See (info "(elisp) Syntax of Regexps") for details. You can evaluate that which will jump to the corresponding info page.



It's far easier and more readable to use the rx macro to create regexps in Emacs. Here is my translation to rx syntax of your example:



(rx line-start
(= 2 (and (one-or-more any) " "))
(group (one-or-more any))
" "
(group (one-or-more digit)))


And here is resulting regex string:



"^\(?:.+ \)\2\\(.+\) \([0-9]+\)"


Note that any which is expressed in regexps as "." does not match newlines in Emacs.






share|improve this answer



























  • Thank you explaining rx macro.

    – maindoor
    Aug 11 at 23:50











  • @Drew Thanks for editing!

    – clemera
    Aug 12 at 5:10






  • 1





    '**any** which is expressed in regexps as "." does not match newlines in Emacs.' - you can also write it as not-newline or nonl to make that clearer.

    – npostavs
    Aug 12 at 13:13











  • @npostavs Thanks, nice to know!

    – clemera
    Aug 12 at 13:19













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "583"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f52114%2felisp-regular-expression-build-problem%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5















Emacs regexps do not use S or s for non-whitespace and whitepsace. See (info "(elisp) Syntax of Regexps") for details. You can evaluate that which will jump to the corresponding info page.



It's far easier and more readable to use the rx macro to create regexps in Emacs. Here is my translation to rx syntax of your example:



(rx line-start
(= 2 (and (one-or-more any) " "))
(group (one-or-more any))
" "
(group (one-or-more digit)))


And here is resulting regex string:



"^\(?:.+ \)\2\\(.+\) \([0-9]+\)"


Note that any which is expressed in regexps as "." does not match newlines in Emacs.






share|improve this answer



























  • Thank you explaining rx macro.

    – maindoor
    Aug 11 at 23:50











  • @Drew Thanks for editing!

    – clemera
    Aug 12 at 5:10






  • 1





    '**any** which is expressed in regexps as "." does not match newlines in Emacs.' - you can also write it as not-newline or nonl to make that clearer.

    – npostavs
    Aug 12 at 13:13











  • @npostavs Thanks, nice to know!

    – clemera
    Aug 12 at 13:19















5















Emacs regexps do not use S or s for non-whitespace and whitepsace. See (info "(elisp) Syntax of Regexps") for details. You can evaluate that which will jump to the corresponding info page.



It's far easier and more readable to use the rx macro to create regexps in Emacs. Here is my translation to rx syntax of your example:



(rx line-start
(= 2 (and (one-or-more any) " "))
(group (one-or-more any))
" "
(group (one-or-more digit)))


And here is resulting regex string:



"^\(?:.+ \)\2\\(.+\) \([0-9]+\)"


Note that any which is expressed in regexps as "." does not match newlines in Emacs.






share|improve this answer



























  • Thank you explaining rx macro.

    – maindoor
    Aug 11 at 23:50











  • @Drew Thanks for editing!

    – clemera
    Aug 12 at 5:10






  • 1





    '**any** which is expressed in regexps as "." does not match newlines in Emacs.' - you can also write it as not-newline or nonl to make that clearer.

    – npostavs
    Aug 12 at 13:13











  • @npostavs Thanks, nice to know!

    – clemera
    Aug 12 at 13:19













5














5










5









Emacs regexps do not use S or s for non-whitespace and whitepsace. See (info "(elisp) Syntax of Regexps") for details. You can evaluate that which will jump to the corresponding info page.



It's far easier and more readable to use the rx macro to create regexps in Emacs. Here is my translation to rx syntax of your example:



(rx line-start
(= 2 (and (one-or-more any) " "))
(group (one-or-more any))
" "
(group (one-or-more digit)))


And here is resulting regex string:



"^\(?:.+ \)\2\\(.+\) \([0-9]+\)"


Note that any which is expressed in regexps as "." does not match newlines in Emacs.






share|improve this answer















Emacs regexps do not use S or s for non-whitespace and whitepsace. See (info "(elisp) Syntax of Regexps") for details. You can evaluate that which will jump to the corresponding info page.



It's far easier and more readable to use the rx macro to create regexps in Emacs. Here is my translation to rx syntax of your example:



(rx line-start
(= 2 (and (one-or-more any) " "))
(group (one-or-more any))
" "
(group (one-or-more digit)))


And here is resulting regex string:



"^\(?:.+ \)\2\\(.+\) \([0-9]+\)"


Note that any which is expressed in regexps as "." does not match newlines in Emacs.







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 12 at 0:19









Drew

50.9k4 gold badges65 silver badges114 bronze badges




50.9k4 gold badges65 silver badges114 bronze badges










answered Aug 11 at 21:27









clemeraclemera

2,1607 silver badges26 bronze badges




2,1607 silver badges26 bronze badges















  • Thank you explaining rx macro.

    – maindoor
    Aug 11 at 23:50











  • @Drew Thanks for editing!

    – clemera
    Aug 12 at 5:10






  • 1





    '**any** which is expressed in regexps as "." does not match newlines in Emacs.' - you can also write it as not-newline or nonl to make that clearer.

    – npostavs
    Aug 12 at 13:13











  • @npostavs Thanks, nice to know!

    – clemera
    Aug 12 at 13:19

















  • Thank you explaining rx macro.

    – maindoor
    Aug 11 at 23:50











  • @Drew Thanks for editing!

    – clemera
    Aug 12 at 5:10






  • 1





    '**any** which is expressed in regexps as "." does not match newlines in Emacs.' - you can also write it as not-newline or nonl to make that clearer.

    – npostavs
    Aug 12 at 13:13











  • @npostavs Thanks, nice to know!

    – clemera
    Aug 12 at 13:19
















Thank you explaining rx macro.

– maindoor
Aug 11 at 23:50





Thank you explaining rx macro.

– maindoor
Aug 11 at 23:50













@Drew Thanks for editing!

– clemera
Aug 12 at 5:10





@Drew Thanks for editing!

– clemera
Aug 12 at 5:10




1




1





'**any** which is expressed in regexps as "." does not match newlines in Emacs.' - you can also write it as not-newline or nonl to make that clearer.

– npostavs
Aug 12 at 13:13





'**any** which is expressed in regexps as "." does not match newlines in Emacs.' - you can also write it as not-newline or nonl to make that clearer.

– npostavs
Aug 12 at 13:13













@npostavs Thanks, nice to know!

– clemera
Aug 12 at 13:19





@npostavs Thanks, nice to know!

– clemera
Aug 12 at 13:19

















draft saved

draft discarded
















































Thanks for contributing an answer to Emacs Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f52114%2felisp-regular-expression-build-problem%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림