Questions tagged [pcre]

Perl compatible regular expressions syntax and library

Filter by
Sorted by
Tagged with
3 votes
0 answers
804 views

In journalctl internal grep, is it possible to specify option to only output matched pattern?

I have the following journal messages: $ journalctl _COMM=kwin_wayland -o cat --since "-10s" ... kwin_screencast: Dropping a screencast frame because the compositor is slow kwin_screencast: ...
Ashark's user avatar
  • 889
1 vote
2 answers
71 views

XMLERR: Element '=").*?(?=")</regex' not closed while using lookaround

I am trying to use lookaround element in PCRE2 regex for Wazuh tool, i need to match strings which are in double quotes and made the below regex however it looks its picking up "<" ...
Atul's user avatar
  • 1,891
0 votes
1 answer
159 views

Is possible to discard outer brackets in regex and consider inner bracket inside?

I have many patterns with bracket enclosure, I made a regular expression where is not considering brackets and just only what is inside/between them, but exists a problem when the text within brackets ...
dcubaz's user avatar
  • 23
1 vote
4 answers
594 views

Find lines with first word containing a certain set of letters

The input file exists out of lines containing multiple 10-letter combinations: NGNAEAREAX EAHVSELYCI FNWGNLACQM AWKLRMDHIT PRYMFNYMVM NCNREDEEEQ EAHVSELYCI FNWGNLACQM AWKLRMDHIT PRYMFNYMVM I need a ...
Tomyy's user avatar
  • 155
3 votes
2 answers
782 views

Rename file with the rename tool - moving around square brackets

Rookie question. Following this answer Move last part of filename to front, I'm trying to do the same, except all files in my case contains square brackets. What I want is to move the title to the ...
Nicolas Ø's user avatar
3 votes
3 answers
843 views

Extract text starting at specific category header to next category header from a text file

I have a TOML file in the following format (categories may have any name, the sequential numbering is just an example and not guaranteed): [CATEGORY_1] A=1 B=2 [CATEGORY_2] C=3 D=4 E=5 ... [...
Educorreia's user avatar
3 votes
5 answers
10k views

Matching Repeating Pattern Using Regex

Let's say I have a file like following 1,2,3-5,6 1,2,3-5,6, 1 1-3 1,2,3-,4,5-7 1,2,3-,4,5-7, 1,2,-3,4,5 1,2,-,3,4 1,2,,,3,4 ,1,2,3 Only combination of following rules should be considered as valid: ...
GypsyCosmonaut's user avatar
8 votes
1 answer
5k views

How to refer to matched groups in jq gsub?

Using jq, I want to search for a pattern via regex, and wrap the matched string with something like <div> tags $ echo "\"This is a valid json file"\" | jq '. | gsub("...
Zeta.Investigator's user avatar
6 votes
5 answers
12k views

Local installation of pcre2 not detected while installing R 4.0.4 from source

I am trying to do a build and local install of R 4.0.4 on Red Hat Linux 6.8. There were several unmet dependencies which I resolved by doing local installations (following the procedure in this). ...
Dronacharya's user avatar
0 votes
1 answer
39 views

grep nonascii without pcre

I want to grep nonascii characters from a lot of .gz files. However the below does not work on CentOS 7.6 (GNU grep v2.20) $ zcat yyyy/yyyymmdd/filname.yyyymmdd.gz | grep --color='auto' -P -n "[\...
fivelements's user avatar
2 votes
1 answer
169 views

Can I change the regex engine used to search in `less`?

I would like to use a perl compatible regex engine in the less command line utility. Is that possible?
drevicko's user avatar
  • 343
1 vote
2 answers
443 views

Advanced regex: Can't figure a case where (?R) recursive regex can be used

Is anyone here can explain a case where the recursive Perl/PCRE regex (?R) can be helpful ? I read https://regular-expressions.mobi/recursebacktrack.html?wlr=1 https://perldoc.perl.org/perlre.html#(%...
Mévatlavé Kraspek's user avatar
1 vote
4 answers
6k views

Help with this non-capturing group with grep?

I am new to GNU/Linux and regex. Recently I've been playing around trying to get to grips with regex. So far I feel I've got a pretty solid foundational understanding. I'm digging PCRE at the moment. ...
customcup's user avatar
  • 111
0 votes
1 answer
294 views

build apache on linux server

I have downloaded pcre from https://ftp.pcre.org/pub/pcre/pcre2-10.34.tar.gz and extracted it to /usr/local/lib when I run ./configure --with-included-apr --with-pcre=/usr/local/lib/pcre2-10.34 I ...
Daniel's user avatar
  • 111
3 votes
1 answer
1k views

Postfix PCRE maps broken in RHEL8: "error: unsupported dictionary type: pcre"

My Postfix config worked flawlessly in RHEL 7 and now all maps which rely on PCRE in RHEL are busted after migrating the config to RHEL 8. postfix/cleanup[xxxx]: error: unsupported dictionary type: ...
F1Linux's user avatar
  • 2,456
1 vote
3 answers
591 views

How to replace a line in text using RegEX?

The problem I have is that is trying to match both sets of delimiter (above and below) I'm trying to match only the second part of the delimiter below (bolded). This is so I can add a new version ...
Javier Vazquez's user avatar
1 vote
0 answers
818 views

Postfix not Modifying header Message-Id

I am trying to modify Postfix Message-Ids and I have tried several things but Postfix just ignores the line in header_checks /Message-Id:\s+<(.*?)@.*?>/ REPLACE Message-Id: <[email protected]&...
bacardi_rum2's user avatar
2 votes
5 answers
148 views

How can I extract strings from one file to insert (modified) in a different file?

problem is the following: I have an xml file with data and I am looking for a small part of the data to write it into a new file: content has been shortened by request: snippet if type=dhcp-client: ...
Questi's user avatar
  • 45
0 votes
2 answers
2k views

Regex101 to Grep/egrep returns nothing

I've been playing with the following regex to cut some content from a markdown file for me which works great in regex101 but can't seem to get grep to work with it. Either it errors or doesn't return ...
Matthew Gialelis's user avatar
9 votes
2 answers
356 views

Does GNU grep's -o option ignore zero-length matches?

I found an answer on another site that was suggesting grep -oP '^\w+|$. I pointed out that the |$ is pointless in PCRE, since it just means "OR end of line" and will therefore always be true for ...
terdon's user avatar
  • 241k
0 votes
1 answer
228 views

Correct PCRE in Exim Custom Filter File

My Server: - CentOS 7.6 - Exim 4.91-5 What I am looking to achieve Using Exim I want to silently discard incoming emails from a user set list of wildcard matches. SpamAssassin and other tools are not ...
Martin's user avatar
  • 139
1 vote
1 answer
1k views

ERROR: checking the archiver (false) interface... unknown

While I was installing pcre2-10.21 on Solars 10 (SunOS 5.10 Generic_147440-01 sun4u sparc SUNW,SPARC-Enterprise) the ./configure command led to the above error. checking the archiver (false) ...
Vahid F's user avatar
  • 143
0 votes
1 answer
440 views

ZSH and GDBM support

I am trying to learn more about ZSH and the way that my shell is setup and operates. I am running OSX and have installed ZSH with HomeBrew so as not to use my standard system ZSH. However, before ...
TheDelChop's user avatar
-1 votes
1 answer
2k views

pcre-config error on building Apr-util 1.6.x

I have a working setup on my CentOS system that takes Apache HTTPD, and the supporting libraries such as PCRE, Apr, Apr-util, etc. This is done using a shell script that applies custom patches to the ...
Curious Coder's user avatar
3 votes
1 answer
6k views

swig error in ubuntu 16.04

For some reason swig on my computer is not configured correctly. It gives this output on checking version: $ swig --version swig: error while loading shared libraries: libpcre.so.1: cannot open ...
Piyush Verma's user avatar
0 votes
1 answer
8k views

Cannot locate zlib or pcre location after install

I installed zlib1g zlib1g-dev libpcre3 libpcre3-dev with apt for NGINX open source over installing zlib & pcre in their own folders. I cannot seem to locate both zlib & pcre libraries on my ...
Rhys's user avatar
  • 3
0 votes
1 answer
2k views

Apache 2.4.25 Make failed due to PCRE cannot find pcre.h

I use Solaris 11. pcre.h exist in /opt/app/pcre/lib but Make cannot detect it.How can I include /opt/app/pcre/lib during make? Apache 2.4.25 configure: CC='/opt/app/solarisstudio12.4/bin/cc' CPP='/...
user3323980's user avatar
8 votes
1 answer
9k views

PCRE-regex Use grep to exclude a capturing group

I am using GNU grep with the -P PCRE Regex support for matching strings from a file. The input file has lines containing strings like: FOO_1BAR.zoo.2.someString:More-RandomString (string here too): 0....
Inian's user avatar
  • 12.7k