Questions tagged [posix-ere]

The POSIX Extended Regular Expression is the regex flavor used by the UNIX/Linux egrep command.

For more information about this regex flavor, see:

89 questions
1
vote
1 answer

Converting PCRE to POSIX regular expression

I am working on a MySQL database and noticed that it doesn't natively support PCRE (requires a plugin). I wish to use these three for some data validation (these are actually the values given to the pattern attribute): ^[A-z\.…
Ashesh
  • 3,499
  • 1
  • 27
  • 44
1
vote
2 answers

Find two alternatives for ereg functions

ereg and eregi functions will be deleted from Php. Please help to find alternatives for the following ereg functions: 1) To allow IP addresses only for specific ranges: $targetAddr = "60.37..*..*"; if (!ereg($targetAddr, $_SERVER['REMOTE_ADDR']))…
user
  • 751
  • 2
  • 10
  • 18
1
vote
2 answers

preg_match two variables with metacharacters

I have two string variables which are both file paths. The code that worked used ereg which is deprecated, so I'm trying to rewrite it using preg_match: Old code that worked: $path1 = quotemeta($path); ereg("$path1(.*)$", $path2, $matches); Using…
highlightall
  • 109
  • 1
  • 2
  • 9
1
vote
1 answer

POSIX regular expression for showing line if contains a string

what is the regular expression for showing whole line if it contains particular string? source string is "ABC: i am your father" and I need to show everything on the line after "ABC:" so the final output is "i am your father". Thanks.
1
vote
2 answers

ereg_replace for PHP 5.3 +?

I've seen a solution for not having to rework usage of the ereg function for PHP 5.3: Good alternative to eregi() in PHP It uses if(!function_exists.... Is there a function that can be used in this way for…
axel2sa
1
vote
4 answers

PHP ereg_replace questions

A couple of PHP ereg_replace questions. I have an array of names: $ssKeywords = array("Str", "Int", "String", "As", "Integer", "Variant"); However when I use this ereg_replace: foreach($arKeyword as $aWord) { $sCode = ereg_replace($aWord, "
James Brooks
  • 1,281
  • 5
  • 17
  • 28
0
votes
1 answer

Scheduling Policy

While working on an embedded project; during changing of the scheduling policy from SCHED_OTHER to SCHED_RR I am getting timer issues and stream loading delays. Some issues are not coming during SCHED_OTHER but arriving at SCHED_RR(round robin).…
Gughan
  • 23
  • 2
0
votes
0 answers

Convert PCRE2 to Extended POSIX RE, do I really require lazy?

I have written the following regex: ^project\(.+?version\s*:\s*'(.+?)'.*\)$ The first capture group will grab 0.9.20 from the following block of text: project( 'waybar', 'cpp', 'c', version: '0.9.20', license: 'MIT', meson_version:…
Jacob Birkett
  • 1,927
  • 3
  • 24
  • 49
0
votes
2 answers

POSIX ERE Regex - Creating Efficient Regex

I'm working to create some regex entries that are well-formed, and efficient. I'll place an emphasis on efficient, as these regex entries can see thousands of logs per second. Inefficient regex entries can cause severe performance impacts. Question:…
0
votes
1 answer

Unicode regex expression to POSIX expression conversion to support in Redshift/ Postgresql

I've been trying to convert a unicode regex to POSIX regex to remove \p{So} , \p{Cs}, \p{Cn} and \x1A type of characters from a column. In Informatica I was using reg_replace (col_name,'[\p{So}\p{Cs}\p{Cn}\x1A]',' ') function to filter out these…
0
votes
3 answers

Regex: match only single characters (MySQL)?

I need a regular expression in POSIX ERE format (for MySQL) to match any single standing character (between 2 spaces) in a string : "abc d e f ghi" should match to "d e f" I have only very basic knowledge of regular expressions (in PHP) and can't…
Dylan
  • 9,129
  • 20
  • 96
  • 153
0
votes
0 answers

How does the "leftmost, longest" rule apply to subexpressions in ERE?

The POSIX standard states that for both ERE and BRE: Consistent with the whole match being the longest of the leftmost matches, each subpattern, from left to right, shall match the longest possible string. For this purpose, a null string shall be…
Mahrud
  • 41
  • 3
0
votes
1 answer

Find and replace curly quotes inside a character class

I'm getting strange results when I try to find and replace curly quotes inside a character class, with another character: sed -E "s/[‘’]/'/g" in.txt > out.txt in.txt: ‘foo’ out.txt: '''foo''' If you use a as a replacement, you'll get aaafooaaa.…
Daan
  • 1,417
  • 5
  • 25
  • 40
0
votes
1 answer

Redshift / Regular Expression (Positive Lookbehind and Positive Lookahead) does not work

I'm fairly new to RegEx and am trying to extract following values from key:value pairs in the following text - Values to be extracted - RDU5 String - "stopCode":"RDU5" I'm using following expression - ((?<=stopCode\":\").*?(?=")) This RegEx works…
0
votes
1 answer

Find and Replace multiple strings using a POSIX extended regular expression

I am using Snowflake database and hope to find a single expression that will find and replace multiple items. The column in question has rows containing, Y, Yes, N, NO, and other irrelevant strings. So, in the example below Y and Yes are replaced…