Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
2 votes
2 answers
98 views

Test for Unicode properties on older versions of Perl

Unicode adds new properties to the Unicode database and these are added to later versions of Perl. I'd like to be able to est if a property is allowed on my current version of Perl. I have tried perl -...
JGNI's user avatar
  • 3,973
5 votes
1 answer
63 views

Perl's capture group disappears while in scope

I have very simple code that parses a file name: #!/usr/bin/env perl use 5.040; use warnings FATAL => 'all'; use autodie ':default'; my $string = '/home/con/bio.data/blastdb/phytophthora....
con's user avatar
  • 6,065
1 vote
2 answers
96 views

How to use Perl to replace an entire line where a match is found?

I need to use Perl to replace an entire line if it has a match to a regular expression. For example, if I have this file below: Chicago no Baltimore no New York no And I have a regex that returns ...
Billy Rice's user avatar
1 vote
1 answer
108 views

Perl unpack command works diffrently in Unix and Linux?

I am trying to use unpack logic of perl in unix and Linux, But see it sa huge diffrence when I iterate all the input binary string , Not sure how to solve the issue ??? or is platform related ??? $...
user15382501's user avatar
1 vote
2 answers
131 views

Is it possible to optionally match paired quotations marks (before and after a string)?

I'm trying to make a substitution in a file with a one liner regex. sed failed me so I turned to perl. I can for example match "setting = value # comment" and extract it in three parts "...
Bernd Wechner's user avatar
0 votes
2 answers
77 views

Whats wrong with `s/"((?:[^"]|\\")*)"//` parsing a C string in Perl?

It seems I'm sitting on my eyes, because I cannot find out whats wrong with my regular expression: I'm trying to parse a C source file that contains strings within a line (actually those strings are ...
U. Windl's user avatar
  • 4,069
2 votes
2 answers
107 views

perl regex negative lookahead replacement with wildcard

Updated with real and more complicated task: The problem is to substitute a certain pattern to different result with or without _ndm. The input is a text file with certain line like: /<random path&...
David Peng's user avatar
1 vote
2 answers
88 views

Substitute the ICON reference for nothing

On an export file of more than 2600 bookmarks from Firefox, I want to import them into Buku which seems to bug with the ICON in the html file. So I want to substitute the ICON reference for nothing. ...
Boulou's user avatar
  • 21
0 votes
3 answers
132 views

Perl Regex for converting query strings

I need to convert some Oracle query strings to be Postgres compatible. Some of the queries use the Oracle TO_NUMBER function which isn't valid in Postgres. So I need to remove all occurrences of the ...
SteveTR's user avatar
  • 79
-8 votes
1 answer
221 views

Regexp to remove small numbers and leave large ones [closed]

On text files with many paragraphs, sentences or phrases are numbered.  I use regexp in Perl to remove those numbers.  They are always followed by the first letter of the sentence/phrase or by a space....
WGroleau's user avatar
  • 457
1 vote
2 answers
108 views

Regex for deconstructing SQL where statement

Looking for a fancy regex to split partial SQL where statement. Legacy app is quite old and records below are manually entered, which allows for a lot of mistakes. Given below where code I need to ...
niebyl2002's user avatar
1 vote
1 answer
104 views

Combine 2 regex matches

I have 2 regex expressions which are capturing both instances of what I need. However, I need to combine them so I only have 1 regex. These are complicated to me, and I'm not exactly sure how to ...
James Finnegan's user avatar
-3 votes
1 answer
80 views

parse string by comma, but ignore comma's within quotes and parentheses

I'm trying to pull out all comma separated entries from strings but I'm having issues with some values that have comma's in quoted data, or within parentheses. I've tried to use Parse::CSV and Text::...
James Finnegan's user avatar
5 votes
3 answers
328 views

Regular expression for zero-width Unicode characters

I’m converting a table to a human-readable form, and I need to treat the content with zero-length Unicode characters “in a distinctive way”. The only way to recognize them seems to be (even with Perl’...
Ilya Zakharevich's user avatar
2 votes
2 answers
87 views

How to embed s/\A{/LB/ in the EXPR of s{...}{EXPR}e?

I've read 'Quote and Quote-like Operators' in man perlop but can't figure out how to use s/.../EXPR/e if EXPR contains code which itself contains a substitution involving both \A and the outer ...
jimav's user avatar
  • 809

15 30 50 per page
1
2 3 4 5
565