Questions tagged [regex-negation]

Regex-negation is an operation performed on a character class that complements its pattern. The result is the character class matching anything not in its class.

Regular Expression negation is typically used to search for patterns that are not desired.

The regular expression language provides some features to handle this, notably negative lookahead/lookbehind, see this tutorial for details.

1926 questions
0
votes
2 answers

Regular Expression for numericals

Hi People I am very new at Regex. I found out that 0-99 has expression "(?:\b|-)([1-9]{1,2}[0]?|99)\b" and 100-200 has "[1-2]\d\d". I wanted to find out how it would be to write a range 9990001 - 9999991. Any answer which makes it work would be…
0
votes
1 answer

Regex match regex with 1 statement but not another

I'm trying to match this regex (sq.*f|gla|livingarea) but I want it to not have the letters 'pr' anywhere in there. so things like sqftpr or pricesqft etc dont' match. I can prevent pricesqft with negative…
Chase R Lewis
  • 2,119
  • 1
  • 22
  • 47
0
votes
1 answer

Remove domain from a text

I have a list of domain name with parameters http://www.anandinfra.net/project.php?id=2 http://artlinkinteriors.com/page.php?id=1 http://www.rabinmukherjeecollege.in/notice_details.php?id=1 I need to find other parts with domain and I have to…
0
votes
3 answers

Regex Expression that matches a pattern except for specific matches

I'm trying to extract Names from a HTML Response using a RegEx. So far I'm able to do so except I'm getting more than I need, I want to NOT match specific strings such as "Date" or "Today". Here is my regex:
0
votes
1 answer

REGEXP to find the first occurrence of a string not followed by another string

I have a few pages of JSON to search like this: "company": "chocolate factory" "position": "founder" "company": "chocolate packagers" "position": "packager" "company": "chocolate shop" "position": "clerk" I want to match only if the first…
user09274385
  • 55
  • 1
  • 9
0
votes
0 answers

Python regex: how to ignore a specific string with any digits? Negative Lookahead

I have the following input st=""" I need 2 position Urgent 400-500$. It would be a Programmer($ 500 ~ $ 1000) or Software and Business Analyst Manager salary in range 1k-1.2k with IT Manager Urgent 900-1,000$ 3 positions 3positions """ and I want…
Sovary
  • 692
  • 4
  • 11
0
votes
1 answer

regex search for two characters including one symbol

I need to search for a digit and € Symbol. Examples: 1€ 2€ But I also find \d€ in these examples: 1,20€ 1.30€ 1,99€ So I need a string with only searches for two characters containing a digit and a € symbol without any digits before that. I came up…
Kai S
  • 3
  • 4
0
votes
1 answer

Notepad++ how to extract only the text field which is needed?

I have a log file which has lot of data. But it would be in similar format. Sample text: Line 1428: [errormessage] = 21:26:07.629 acceptance criteria not met. Expected:0.0009999871, Actual:0.007407427, Window:[0.007407427] at…
user2500239
  • 43
  • 1
  • 7
0
votes
1 answer

Regex that match functions name but not declarations in source code

I am trying to find function names in source codes but not in function declarations. Let's say we have the following source code: function foo() { if ( ! foo5() ) foo3(bar("string"), foo2()); else foo3(bar("string")); } function foo4() { if…
HadiRj
  • 1,015
  • 3
  • 21
  • 41
0
votes
0 answers

Using Scanner to read a .java file in Java: Applying regex to use function calls as a delimiter

I'm working on a project that involves reading in a .java file and reporting on aspects of the code, such as functions, line counts and indentation. I would like to use a function declaration as a delimiter when scanning the file. To identify when…
0
votes
1 answer

RegEx select whole string but omit substring match

Consider a long html string: I need to have the whole content without certain tags sections. Example: Consider the following string: ;decreasing'>1 2
polarized
  • 23
  • 1
  • 4
0
votes
3 answers

Regex - forbidding a certain string

So I'm new to regex and trying to write a regex that will match this: example.com/some-url-text-here/ but not something like…
ocean800
  • 3,489
  • 13
  • 41
  • 73
0
votes
2 answers

Regex- Extract a text that is between 1 and 8 chars and does not contain more than 2 letters ([A-Za-z])

I would like to extract a text using Regex that is between 1 and 8 chars and does not contain more than 2 letters ([A-Za-z]). For example: Valid: "12A-32B" from the text "Register:12A-32B Index:A" Invalid: "12 Index" from the text "Register:12…
Daniel
  • 13
  • 5
0
votes
1 answer

Find items where matched group is more / less than using regex

Given the following text:

Some text

* Item 1

// Should match

* Item 2

* Sub Item 1a

// Should match
Amo
  • 2,884
  • 5
  • 24
  • 46
0
votes
1 answer

Regular expression for an email address not end with

I want to use regex in ruby to capture the plain text email address but NOT the email address surrounded by mailto link tags (like a@b.com), tried source.gsub(/(?!<$)[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i) but this does…
shawn
  • 1