Skip to main content

All Questions

Tagged with
3 votes
3 answers
663 views

Bash [[ test =~ regex ]] vs perl command result

Is the bash operator =~ equivalent to a perl invocation? filename="test-33.csv" regex="([^.]+)(-\d{1,5})(\.csv)" With bash test: if [[ "$filename" =~ $regex ]]; then ...
rellampec's user avatar
  • 133
1 vote
1 answer
454 views

Combine two regex formulas into one (using notepad++)

Si cum îi semănau ! Fraţi buni, puindu-si, ca si el, tot sufletul în ceea ce făceau, muncind din greu, luptind din greu, jert- findu-se, fără nici un gînd de răsplată. Simțind în tot ceasul, ...
Just Me's user avatar
  • 866
2 votes
4 answers
342 views

REGEX Find the string between 2 strings

In the example below, I want to use regex as to find the html tag <sony> between other 2 lines. <table width="697" border="0"> <tr> <td&...
Hellena Crainicu's user avatar
0 votes
1 answer
54 views

regexp in perl fails

Why is this failing? WGroleau@MBP Chords % perl -p -i -e '(Trinidad|Donoso|Clifton|Frincke|Little|Church|Antonio) XYZ :\1\t:g;' *txt Bareword found where operator expected at -e line 1, near ") ...
WGroleau's user avatar
  • 824
1 vote
1 answer
57 views

perl extended regex pattern with (condition) behaves wrong, what I do false?

I use perl --version perl 5, version 36, subversion 0 (v5.36.0) built for i686-linux-gnu-thread-multi-64int (with 52 registered patches I have used following test lines with these results: perl -we '$...
Anton Wessel's user avatar
0 votes
1 answer
415 views

Perl regex unable to match using hex or octal

I need to use Perl to work with a data file that contains a lot of unprintable characters, i.e. not within the displayable character range in the ASCII table. I tried writing regexes using octal ...
Isla's user avatar
  • 1
0 votes
1 answer
218 views

quote mark (U+0027) in perl substitution

I need to put two spaces between sentences in a large number of text files. A sentence ending is defined as period, exclamation, or question, maybe a close-quote, and then a space. Tabs and line ...
WGroleau's user avatar
  • 824
0 votes
1 answer
39 views

Perl RE global matching is not working /.*(11).*/g

I have a file containing this single line: 111112111122113 I want to match all two element sequences of 1 in all occurrences. But when I try this $ perl -lne 'print $1 if /.*(11).*/g' u I get only ...
user1642683's user avatar
0 votes
0 answers
161 views

Perl, modifiers /m /s/ /ms

I have seen in Larry's Wall book programming Perl 3rd edition what do the modifiers /s /m /ms in some example with \n . Now I cannot find the exact page. Specifically the example showed that only the ...
user2925716's user avatar
0 votes
1 answer
277 views

Why does this regexp — which attempts to match characters between “@” characters — fail?

I need to extract the second field of selected lines in a GEDCOM file. These lines are all of the following format: % grep @ /tmp/XYZ | tail -5 0 @X701@ OBJE 0 @X702@ OBJE 0 @X750@ OBJE 0 @X765@ OBJE ...
WGroleau's user avatar
  • 824
0 votes
1 answer
52 views

a very simple Perl script needed

I have the following text file G.txt. I need a perl command perl -e ... that would extract all negative entries ending with Kč, so that first line it will be -107,60 and last will be -63,00 I have ...
user113823's user avatar
1 vote
2 answers
996 views

Regex to substitute character with numbers around it in filenames with rename utility (perl based)

I would like to rename files that have the following format: somethingblabla15T06:58_31+0000somethingblabla.bla THe new name should be somethingblabla15T06:58:31+0000somethingblabla.bla So the _ ...
linux_user_11880's user avatar
0 votes
1 answer
240 views

How to add prefix from row at the beginning few next lines in Notepad++?

I would like to use a line as a prefix for a few more lines. For an example, please consider the situation where I have these lines: hostname-junek-1 ;ge-1/0/1 ;ge-1/0/2 ;ge-1/0/5 ;ge-1/1/27 ;ge-1/1/...
Celafon's user avatar
1 vote
1 answer
382 views

replace sub-string with last special character, being (3rd part) of comma separated string

I have a string with comma separated values, like: 742108,SOME-STRING_A_-BLAHBLAH_1-4MP0RTTYE,SOME-STRING_A_-BLAHBLAH_1-4MP0-,,, As you can see, the 3rd comma separated value has sometimes special ...
Kostas75's user avatar
  • 111
0 votes
1 answer
525 views

Named capture groups from command line

I've come up with the following regular expression: \[release(\s+(?<release_type>.*))?\]\n+(?<release_notes>.*) The idea is to parse a commit message for several params: [release minor] ...
Léo Natan's user avatar

15 30 50 per page