regex-negation

Regex match a word not followed by two other words

大憨熊 提交于 2020-02-16 11:31:42
问题 I have some links: utmcsr=rdstation|utmccn=curso-intro-coaching|utmcmd=inbound|utmctr=link3 utmcsr=rdstation|utmccn=agenda-psc|utmcmd=email utmcsr=rdstation|utmccn=pnl-porto-alegre I want to build a regex expression that matches the rdstation not followed by inbound OR email . I've tried rdstation(?!(email|inbound)) but it doesn't worked. 回答1: The problem is that your negative lookahead is anchored to the position directly after rdstation. It would only exclude strings like this:

.net regex - strings that don't contain full stop on last list item

别说谁变了你拦得住时间么 提交于 2020-02-06 07:56:34
问题 I'm trying to use .net regex for identifying strings in XML data that don't contain a full stop before the last tag. I have not much experience with regex. I'm not sure what I need to change & why to get the result I'm looking for. There are line breaks and carriage returns at end of each line in the data. A schema is used for the XML. Example of good XML Data: <randlist prefix="unorder"> <item>abc</item> <item>abc</item> <item>abc.</item> </randlist> Example of bad XML Data - regexp should

.net regex - strings that don't contain full stop on last list item

馋奶兔 提交于 2020-02-06 07:56:10
问题 I'm trying to use .net regex for identifying strings in XML data that don't contain a full stop before the last tag. I have not much experience with regex. I'm not sure what I need to change & why to get the result I'm looking for. There are line breaks and carriage returns at end of each line in the data. A schema is used for the XML. Example of good XML Data: <randlist prefix="unorder"> <item>abc</item> <item>abc</item> <item>abc.</item> </randlist> Example of bad XML Data - regexp should

Regex to match consecutive n (alpha numeric)

允我心安 提交于 2020-01-30 08:19:27
问题 I am trying to match consecutive n(alpha numeric) characters in a string. Where n = 3 i7g172w2n YES (it has 3 consecutive number) adab172cd NO (it has 4 consecutive alpha even though it has 3 consecutive number) aaa172afa YES (it has 3 consecutive number and 3 consecutive alpha) ab21cd172 YES abc21a3d3 YES Can some one help me. Here is my regex : (\D(\d{3})\D)|\d([a-z]{3})\d not working. 回答1: Try with following regex. Regex: ^(?:(?:\d{0,3}[a-z]{1,3}\d{1,3})+|(?:[a-z]{0,3}\d{1,3}[a-z]{1,3})+)$

What is the regex to match a string not containing more than x consecutive characters

梦想与她 提交于 2020-01-25 08:16:47
问题 I want to match strings that do not contain more than 3 of the same character repeated in a row. So: abaaaa [no match] abawdasd [match] abbbbasda [no match] bbabbabba [match] Yes, it would be much easier and neater to do a regex match for containing the consecutive characters, and then negate that in the code afterwards. However, in this case that is not possible. I would like to open out the question to x consecutive characters so that it can be extended to the general case to make the

.net regex - strings that don't contain full stop preceding last `<item>` - Attempt 2

╄→гoц情女王★ 提交于 2020-01-25 06:44:35
问题 This question follows from .net regex - strings that don't contain full stop on last list item Problem is now the below. Note that examples have been amended and more added - all need to be satisfied. Good examples should return no matches, and bad examples should return matches. I'm trying to use .net regex for identifying strings in XML data that don't contain a full stop before the last tag. I have not much experience with regex. I'm not sure what I need to change & why to get the result I

.net regex - strings that don't contain full stop preceding last `<item>` - Attempt 2

自闭症网瘾萝莉.ら 提交于 2020-01-25 06:44:08
问题 This question follows from .net regex - strings that don't contain full stop on last list item Problem is now the below. Note that examples have been amended and more added - all need to be satisfied. Good examples should return no matches, and bad examples should return matches. I'm trying to use .net regex for identifying strings in XML data that don't contain a full stop before the last tag. I have not much experience with regex. I'm not sure what I need to change & why to get the result I

What is the regex to match a string not containing more than x consecutive characters

橙三吉。 提交于 2020-01-22 02:59:04
问题 I want to match strings that do not contain more than 3 of the same character repeated in a row. So: abaaaa [no match] abawdasd [match] abbbbasda [no match] bbabbabba [match] Yes, it would be much easier and neater to do a regex match for containing the consecutive characters, and then negate that in the code afterwards. However, in this case that is not possible. I would like to open out the question to x consecutive characters so that it can be extended to the general case to make the

Regex for find All ip address except IP address starts with 172

大憨熊 提交于 2020-01-22 00:23:08
问题 I want regex to find IP address which not starts with 172.0.0.0. I have written some regex ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$ which finds all ip address. 回答1: . in a regex is character that matches everything. To use it in this context, you must escape it. Also to limit it to just ip addresses that start with 172, simply hardcode it into your regex like so: ^172\.\d{1,3}\.\d{1,3}.\d{1,3}$ Debuggex Demo You could then use this to filter out any matches already made. Alternatively, if you're

Regex for find All ip address except IP address starts with 172

 ̄綄美尐妖づ 提交于 2020-01-22 00:22:25
问题 I want regex to find IP address which not starts with 172.0.0.0. I have written some regex ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$ which finds all ip address. 回答1: . in a regex is character that matches everything. To use it in this context, you must escape it. Also to limit it to just ip addresses that start with 172, simply hardcode it into your regex like so: ^172\.\d{1,3}\.\d{1,3}.\d{1,3}$ Debuggex Demo You could then use this to filter out any matches already made. Alternatively, if you're