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
38
votes
5 answers

What's the difference between vim regex and normal regex?

I noticed that vim's substitute regex is a bit different from other regexp. What's the difference between them?
guilin 桂林
  • 17,050
  • 29
  • 92
  • 146
38
votes
5 answers

PHP ereg vs. preg

I have noticed in the PHP regex library there is a choice between ereg and preg. What is the difference? Is one faster than the other and if so, why isn't the slower one deprecated? Are there any situations where it is better to use one over the…
Evernoob
  • 5,551
  • 8
  • 37
  • 49
37
votes
6 answers

What is the difference between split() and explode()?

The PHP manual for split() says This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged...Use explode() instead. But I can't find a difference between split() and explode(). join() hasn't been…
Theodore R. Smith
  • 21,848
  • 12
  • 65
  • 91
27
votes
4 answers

Deprecated: Function split() is deprecated. How to rewrite this statement?

I have the following statement which worked fine before PHP 5.3 using the split function: list($year, $month, $day, $hour, $min, $sec) = split( '[: -]', $post_timestamp ); After upgrading to PHP 5.3, I get the Deprecated warning: Deprecated:…
morpheous
  • 16,270
  • 32
  • 89
  • 120
22
votes
4 answers

ereg/eregi replacement for PHP 5.3

I'm sorry to ask a question but I am useless when it comes to understanding regex code. In a php module that I didn't write is the following function function isURL($url = NULL) { if($url==NULL) return false; $protocol =…
Colin
  • 231
  • 1
  • 2
  • 7
20
votes
2 answers

How to change PHP's eregi to preg_match

Possible Duplicate: How can I convert ereg expressions to preg in PHP? I need help, below is a small VERY basic regex to somewhat validate an email, I do realize it does not work the greatest but for my needs it is ok for now. It currently uses…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
12
votes
3 answers

ereg_replace to preg_replace?

How can I convert ereg_replace(".*\.(.*)$","\\1",$imgfile); to preg_replace... ? ? I'm having trouble with it?
sml
  • 133
  • 1
  • 1
  • 6
11
votes
4 answers

How to replace ereg?

I'm getting the following message for some php I have to use but did not write: Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/webEchange/SiteWeb_V5/inc/html2fpdf.php on line 466 This is line…
Shawn
  • 10,931
  • 18
  • 81
  • 126
10
votes
1 answer

POSIX Regular Expressions: Excluding a word in an expression?

I am trying to create a regular expression using POSIX (Extended) Regular Expressions that I can use in my C program code. Specifically, I have come up with the following, however, I want to exclude the word "http" within the matched expressions. …
9codeMan9
  • 802
  • 6
  • 11
  • 25
9
votes
1 answer

Odd Behavior with Greedy Modifiers Inside Capture Groups

Consider the following commands: text <- "abcdEEEEfg" sub("c.+?E", "###", text) # [1] "ab###EEEfg" <<< OKAY sub("c(.+?)E", "###", text) # [1] "ab###EEfg" <<< WEIRD sub("c(.+?)E", "###", text,…
BrodieG
  • 51,669
  • 9
  • 93
  • 146
8
votes
3 answers

POSIX character equivalents in Java regular expressions

I would like to use a regular expression like this in Java : [[=a=][=e=][=i=]]. But Java doesn't support the POSIX classes [=a=], [=e=] etc. How can I do this? More precisely, is there a way to not use US-ASCII?
Stephan
  • 41,764
  • 65
  • 238
  • 329
4
votes
2 answers

How to escape characters in Haskell's Text.Regex library?

Introduction I'm using Haskell's Text.Regex library and I want to match some characters that normally have meaning in regular expressions. According to Text.Regex's documentation, The syntax of regular expressions is ... that of egrep (i.e. POSIX…
Elliot Cameron
  • 5,235
  • 2
  • 27
  • 34
4
votes
1 answer

Greedy behaviour of grep

I thought that in regular expressions, the "greediness" applies to quantifiers rather than matches as a whole. However, I observe that grep -E --color=auto 'a+(ab)?' <(printf "aab") returns aab rather than aab. The same applies to sed. On the…
Joseph Stack
  • 566
  • 5
  • 14
4
votes
2 answers

How do I split words on punctuation in git diff?

I've have some luck with the following command: git diff --color-words='[^][<>()\{},.;:?/|\\=+*&^%$#@!~`"'\''[:space:]]+|[][<>(){},.;:?/|\\=+*&^%$#@!~`"'\'']' but it doesn't seem to negate the square brackets properly in the first character…
Walf
  • 8,535
  • 2
  • 44
  • 59
4
votes
2 answers

What is the special character / escape for "whitespace" in a POSIX extented regular expression?

I am new to this regular exp concept. I am trying to use this reg ex [^@\s]+$ If i give the string as "abs", its actulally excluding the character 's' . which means '\s' is read as a character 's' rather than a whitespace. Please help me to solve…
user3913114
  • 105
  • 3
  • 11
1
2 3 4 5 6