Questions tagged [regular-expressions]
is for patterns specifying search or replace strings. Also known as `regex` or `regexp`, the patterns describe strings to match when searching or replacing. Emacs provides extensive support for `regex` patterns in many commands. Emacs also provides an interactive expression builder for such patterns.
512 questions
1 vote
1 answer
77 views
How to search for string with specific initial and final delimiter but not containing a particular substring?
In a very long text, I'd like to search for strings with the following properties: Starts with (let's say) #. Ends with (let's say) @. Does not contain # or @. Does not contain the substring (let's ...
1 vote
1 answer
72 views
Append .*? in isearch-forward-regexp search string by pressing TAB key
I would like to append .*? in isearch-forward-regexp search string when I press TAB key. I have tried ;; Insert .*? on space inside isearch regexp (define-key isearch-mode-map (kbd "<tab>&...
1 vote
0 answers
31 views
How to restrict the regions to skip (or "hide") in ediff buffer comparison, to those that completely match the whole regex?
I have a file that is automatically generated, and another one based on a version of the former with lots of systematic additions. Those additions are always the same text for the whole line, so it ...
0 votes
1 answer
40 views
Minus sign inside circular parens in regex is confusing
In Appendix A.3 of org manual, Adding Hyperlink Types, there is this function org-man-get-page-name that extracts the page name from buffer name. Like the buffer name is "Man printf*", it ...
0 votes
1 answer
70 views
Using regular expressions as a set to check if a certain character is in it. Create a list from regular expresion
How can I check if a certain character is into set of regular expression without searching in buffer? For example: this regular expression "[a-zA-Z0-9-+=*/_~!@$%^&:<>{}?\t\n\r]" ...
0 votes
1 answer
67 views
Why does `\s` not work in helm-swoop regex search while `[[:space:]]` does?
I'm using helm-swoop to search within the current buffer using regular expressions. My goal is to find lines containing a whitespace character followed immediately by the digit 4. Consider a buffer ...
1 vote
1 answer
142 views
TAB character in regular expression Isearch
I can't find TAB characters with the regular expression \t. When I press C-M-s followed by \t, Emacs only finds characters t. I'm working with version 28.2 on macOS Monterey.
1 vote
1 answer
78 views
Ignoring scripts in regexp word boundaries
The elisp manual info node 35.3.1.3 Backslash Constructs in Regular Expressions says that ‘\<’ matches the empty string, but only at the beginning of a word.... ‘\>’ matches the empty ...
2 votes
0 answers
90 views
How to do multi-line regex replace across multiple files?
What I want A convenient way (with preview, interactivity) to replace regex multi-line matches across many files What I already have I know how to do this for single-line matches. I use counsel-rg, ...
2 votes
1 answer
151 views
Make non-regexp searches always case insensitive and regexp searches always case sensitive
I'd like my fixed-string searches to be always case insensitive, my regexp searches to be always case sensitive, and I don't want search-upper-case to change the case of my search strings. This should ...
1 vote
1 answer
62 views
highlight full word
I'm trying to make word highlighting in emacs. Let's take the example: "fix the radio. radio fixed." I want to highlight the word "fix", but not the first three letters of the word ...
0 votes
1 answer
62 views
Regexp: Regexp that matches ")" but NOT "()"
I am writing a function that needs to move the character back to the first ")" character. However, in the middle there might be a "()" characters, I do NOT want the cursor to go ...
0 votes
2 answers
109 views
whitespace-mode: Only display leading whitespace
I want to preface this question by stating that I read: How to display and format leading spaces (spaces at the beginning of a line) with whitespace-mode? However, it's not solving my problem. I want ...
0 votes
1 answer
126 views
How to Replace the Second Character with Emacs Regex?
Replace the first or second Character xxx-xxx-xxx => xxx-xxx*xxx or xxx-xxx-xxx => xxx*xxx-xxx
0 votes
1 answer
177 views
I am not getting desired output using this auto template in Emacs verilog-mode, i am using this from veripool.org . What mistakes i am doing in code?
I have 1 top module and 1 submodule and i want to autoinst using auto template and regex, my modules are:- module submodule ( input [31:0] in_data, input in_valid, ...