Regex How can I accept mail from only one domain in smtp-gated?

I need a Perl-compatible regular expression for filtering my email with smtp-gated. I only want to allow one domain ('mydomain.com') and reject everything else. How do I do this in a foolproof way? (regex_reject_mail_from) I know this question halfway belongs on serverfault, but basically it's a Perl regex question so I think it fits stackoverflow more. EDIT: This should match so I can reject it: "Someone" <someone@somedomain.com> This should not match: "Me" <me@mydomain.com>

Regex Recursive regular expression,how to match the coupled string with regular expression?

... AA BB sysodufsoufdds BB AA ... Where AA,BB can be arbitary consecutive string with no space in it. But I want to get the outest pair:AA More examples: Input: a HH CC abc CC HH c Output: HH Input: x YYYY j DD GG DD hsu DD GG DD k YYYY o Output: YYYY To make my question more general,how to match a specific tag in html with regular expression?I've seen various posts discussing about this,but none of them give a answer by regex.Related questions are: I'm looking

select part of filename using regex

I got a file that looks like dcdd62defb908e37ad037820f7 /sp/dir/su1/89/asga.gz 7d59319afca23b02f572a4034b /sp/dir/su2/89/sfdh.gz ee1d443b8a0cc27749f4b31e56 /sp/dir/su3/89/24.gz 33c02e311fd0a894f7f0f8aae4 /sp/dir/su4/89/dfad.gz 43f6cdce067f6794ec378c4e2a /sp/dir/su5/89/adf.gz 2f6c584116c567b0f26dfc8703 /sp/dir/su6/895/895.gz a864b7e327dac1bb6de59dedce /sp/dir/su7/895/895.gz How do i use sed to substitue all the su* such that I can replace with a single value like sed "s/REXEXP/newfolde

Regex Regular expression to extract text between square brackets

Simple regex question. I have a string on the following format: this is a [sample] string with [some] special words. [another one] What is the regular expression to extract the words within the square brackets, ie. sample some another one Note: In my use case, brackets cannot be nested.

in emacs-lisp, how do I correctly use replace-regexp-in-string?

Given a string, I want to replace all links within it with the link's description. For example, given this is a [[http://link][description]] I would like to return this is a description I used re-builder to construct this regexp for a link: \\[\\[[^\\[]+\\]\\[[^\\[]+\\]\\] This is my function: (defun flatten-string-with-links (string) (replace-regexp-in-string "\\[\\[[^\\[]+\\]\\[[^\\[]+\\]\\]" (lambda(s) (nth 2 (split-string s "[\]\[]+"))) string)) Instead of re

Regex to read fixed width numeric fields

I would like regex(es) that can parse right-justified numeric values in a fixed length field with optional leading whitespace. (This is essentially FORTRAN output but there are many other tools that do this). I know the width of the field. Assume the field is an integer of width 5 (I5). Then the following are all conformant numeric values: " 123" "12345" "-1234" " -1" I can make no assumption about the previous and following fields. Thus the following is valid for I3,I5,I2: "-121234512"

My regex pattern is failed

i need some help. My data; {foreach $page_list as $page} <li><a href="" title="{$page->name}">{$page->name}</a></li> {/foreach} And my pattern; ~\{foreach\s\$(.+)\sas\s\$([^\{]+)\}([^\{]+)\{\/foreach\}~ But it's not working. What is wrong ?

Regex to Remove HTML Tags

input: <td> <span> <span>spanaaa</span> <span class="1">spanbbb</span> <span class="" style="">spanccc</span> <span style="display:none">spanddd</span> <div>divaaa</div> <div class="1">divbbb</div> <div class="" style="">divccc</div> <div style="display:none">divddd</div> </span> </td> I need a regular express or a method in order to get the values without attribute style="

Regex Split on first comma in string

How can I efficiently split the following string on the first comma using base? x <- "I want to split here, though I don't want to split elsewhere, even here." strsplit(x, ???) Desired outcome (2 strings): [[1]] [1] "I want to split here" "though I don't want to split elsewhere, even here." Thank you in advance. EDIT: Didn't think to mention this. This needs to be able to generalize to a column, vector of strings like this, as in: y <- c("Here's comma 1, and 2, see?", "Here's 2n

Regex How to backtrack in regular expression

I'm trying to validate url which doesn't contain login before .com at the end, but the regex at here is not validating the url properly. I've used the lazy quantifier, but it is still consuming login string before moving to (?!login) part, and it is not backtracking. Could anyone please tell me what wrong I'm doing?

Why non-word chars are not matched in my regex?

I need to capture string between quote chars (") to change quotes for fancy ones, thus i created substitution, my code: my $pk = qq|IV Baltic Sea NGO Forum "Challenges for Baltic Sea civil society"|; $pk =~ s/"(\p{Word}+.?+)"/«$1»/g; say $pk; I meant regex as that: quoting char followed by at least one word char followed by any char until next quoting char (non-greedy capture) I don't get captured when there is any non-word char between quotes. Why? I found another solution too, but i'd

TRegEx Replace Pattern?

I have a json data "myObject": { "field1": 1, "field2": true, "fileURL": [ "" ] } How to replace into "fileURL":["here url"] ? var pattern:string; begin pattern:='"fileURL":[ "?" ]'; Memo1.Text:=TRegEx.Replace(Trim(Memo1.Text),pattern,'C:\file1.doc'); end;

Regex Remove date from log files

I have an irc log as follows 04/14/13 21:38<@Hamatti> Lorem ipsum dolor sit amet 04/14/13 21:39<@Hamatti> consectetur adipiscing elit. 04/14/13 21:45<@Hamatti> Duis facilisis convallis lacus EDIT1. sorry, I was not clear with my intentions. So I would want the output for the previous to be 21:38<@Hamatti> Lorem ipsum dolor sit amet 21:39<@Hamatti> consectetur adipiscing elit. 21:45<@Hamatti> Duis facilisis convallis lacus so the time is important. EDIT

Replace using regex in sublimetext2

I would like to use regex (preferably in sublimetext2) to replace the following: <td class="etword">et alfabet</td> <td class="etword">&nbsp;</td> with this: <td class="etword">et alfabet</td> <td class="etword"><?php audioButton("../../audio/words/et_alfabet","et_alfabet");?></td> Thanks very much!

RegExp: Last occurence of pattern that occurs before another pattern

I want to take a text pattern that occurs the last before another text pattern. For example I have this text: code 4ab6-7b5 Another lorem ipsum Random commentary. code f6ee-304 Lorem ipsum text Dummy text code: ebf6-649 Other random text id-x: 7662dd41-29b5-9646-a4bc-1f6e16e8095e code: abcd-ebf Random text id-x: 7662dd41-29b5-9646-a4bc-1f6e16e8095e I want to take the last code that occurs before the first occurrence of id-x (which means I want to get code ebf6-649) How can I do that wit

RegEx Expression to find strings with quotation marks and a backslash

I am using a program that pastes what is in the clipboard in a modified format according to what I specify. I would like for it to paste paths (i.e. "C:\folder\My File") without the pair of double quotes. This, which isn't using RegEx works: Find " (I simply enter than in one line) and replace with nothing. I enter nothing in the second field. I leave it blank. Now, though that works, it will remove double quotes in this scenario: Bob said "What are you doing?" I would like the program to re

Regex Perl regular expression to match numerics

Need to match BSC0 to BSC10 and "TOTAL". But the below condition is matching only BSC1 and BSC10. Whats missing? tried with s/regex/ m/regex/ variations also $currentRowHeader will contain single word without spaces if ($currentRowHeader =~ /BSC[0-10]|TOTAL/) { print "OK"}

What is the formal grammar equivalent to this regex?

The regular expression is (a+)+ . Using an NFA this would give reDOS attacks for longer strings . What would be the equivalent grammar for this regular expression ? Now i was trying to determine the grammar in multiple steps . a+ would translate to S -> a S -> aS (a+)+ would translate to G -> S G -> SG I was not sure how to simplify further whether it would be CFG or CSG ? Any suggestions would be of great help

RegEx for validating specific input

The input accepts data in format: %'letter' separator %'letter' and so on. The separator can be: space, tab, colon or new line Example: %d %F %S or %d:%F:%S or %d:%F %S where the character after the '%' can be any letter You cannot write something like: %dddd %F %S or %%d %F %S So far I have done this: ^((%([a-zA-Z]){1})+\s?|:)+$ Any help will be appreciated.

Make regex for exact matching two string words

I am working on Attribute Routing of Web Api 2 . I am trying to implement a Route which contains a regex Url should be like this /xyz/sale /xyz/rent I tried my best and searched alot on google but in-vane . What i tried is [Route(@"xyz/{Type:^sale|rent$}")] But it gives the following error The inline constraint resolver of type 'DefaultInlineConstraintResolver' was unable to resolve the following inline constraint: '^sale|rent$'. here is the screenshot of error Please help me

Regex to exclude match based on string before first forward slash

I want any path string that leads to a file with an extension of '.log' or a path that contains the directory 'tmp' to be excluded from the match I'm nearly there: (?!tmp).+?\.(?!log|tmp).+ http://rubular.com/r/Ubkz7MIEGH What I want is for tmp/hello.jpg to be excluded in the same way that hello.log hmm.tmp Are excluded.

Regex checking version in perl

I am writing sub routine for checking version but some how I am not getting correct output if version 1 < version 2 then -1 if version 1 = version 2 then 0 if version1 > version 2 then 1 Not sure Why I am not getting correct result sub checkVersion { my $var1 = shift; my $var2 = shift; my @var1_seg = split (/./, $var1); my @var2_seg = split (/./, $var2); for( my $i = 0; $i < @var1_seg; $i++ ) { if( $var1_seg[

Regex - Shell scripting

I have a file which looks like this : { "0" : NumberLong(654654), "1" : NumberLong(31321), "2" : NumberLong(44534564), "3" : NumberLong(464564645), } My output should be something like this : 654654 31321 44534564 464564645 I tried to do this : grep -Po ' NumberLong\("\K[^"]*' file But it doesn't seem to work for me.

advanced regex pattern for html5 input

I can't seem to put together a working pattern to disallow all html tags except for the strong and em tag. I don't want to parse the html but just want to give the user a warning that the input will not be accepted. I am aware that this is not supported in all browsers but I would love a pure html solution, as I already have a working JS solution, but I wan't to layer the user experience. <input name="user_input" pattern="^(?!<[^>]*>).*$" /> So allowed tags: strong, em the use

Regex Multiple domains in one .htaccess

I have two domains linked in one FTP, and for me need rewrite .htaccess file, for work like that: site.lt (redirect)-> site.lt site.lt/lv (redirect)-> site.lt site.eu (force redirect)-> site.eu/lv now I have wrote this code in my .htaccess: RewriteCond %{HTTP_HOST} ^site\.(lt|eu) RewriteRule ^(.*)$ http://site.(lt|eu)/$1 [R=permanent,L] RewriteRule ^$ http://site.eu/lv [R=301,L] and it works like: site.lt (redirect)-> site.eu/lv site.lt/lv (redirect)-> not working site.eu (

Regex Expression For Masking Characters

I am using Notepad++ to mask out portions of strings in a text document. I have strings similar to this: B1541123412341234^TEST DATA^125000000,1541123412341234=00000000000125000000 I need to replace the 12 characters after B1541 with Xs. The result will look like this: B1541XXXXXXXXXXXX^TEST DATA^125000000,1541XXXXXXXXXXXX=00000000000125000000 Any advice?

Regex Lists of Start and End Columns of all matches in a line

I'm trying to create a list of start columns and a list of end columns of all matches in a line. This is what I've done: line1: test is PASSED as its the list "that" is [passed] as search: \<[a-zA-Z\x7f-\xff]\+\> (find all words) Commands: let MatchesStart = [] | 1s/\<[a-zA-Z\x7f-\xff]\+\>/\=add(MatchesStart,match(getline(1),submatch(0)))/gn let MatchesEnd = [] | 1s/\<[a-zA-Z\x7f-\xff]\+\>/\=add(MatchesEnd,matchend(getline(1),submatch(0)))/gn Results: MatchesStart

Regex replace regular expression via vimscript

I want to replace the following occurings: @todo call customer @todo-next do foo @todo-wait customer will call me back with @done when I am with the curser on the line. E.g: @todo call customer shall be then @done call customer I got it to replace @todo but for the other two (@todo-next, @todo-wait) I think my regex does not work properly... Heres what I got, when I run it nothings happens on the lines...: function! Tdone( ) let line=getline('.') "let newline = substitute

Need simple regex (regular expression) for dynamic expression

I need a regex to replace this text: ("{scriptid}_*0123_00000000_ABC-Description*"); With this text: ("{scriptid}_*0123_00000000_ABC-Description*")); Or in other words: *I have to add a second closing brace. Explanation: ("{scriptid}_*0123_00000000_ABC-Description*"); ("{scriptid}_4-digits_8-alphanumeric_X-alphanumeric-description"); I tried some expressions but it doesn't really work. Could some one please help me?

Replacing the nth word with regex

I have a csv file where I need to change the 7th and the 8th "cell" with a value from a list. I'm trying to do a replace with a regex but I'm having trouble defining the regex. I tried (\"\w+\").*?(\"\w+\"){7} but without the number the regex appends the 2 cells. (?:[^\"]\w+\") just leaves the first " behind. And (\"\w+\")?(\"\w+\") matches every cell. What I need is given the following line: "b34";"es";"ee";"beer";"beers";"34421";"bye";"bi";"buuu";"fffs" Get the 7th word that would

Regex Extracting a string after pattern PostgreSQL

So I have a column like the following: diagnosis 715.16 oSTEOARTHRITIS, LOWER-LEG 715.17 - OSTEOARTHRITIS, ANKLE AND FOOT 715.90 oSTEOARTHRITIS, UNSPECIFIED 716.10 - TRAUMATIC ARTHROPATHY - UNSPECIFIED Some entries have initial dashes, some do not. Some have dashes later in the string. I'd like to select the substring (in itallics) with the pattern: (any chars)(dash)(space)(any alphanumeric)(the rest of the string) OR (any chars)(space)(any alphanumeric)(the rest of the string) My que

Regex for getting all words and punctuations from a string with html

I'm having trouble coming up with a regex statement that grabs all words and punctuation from a string that looks like <p>hello my name is foo.</p><p>I like to go to the bar.</p> My desired result is... 'hello' 'my' 'name' 'is' 'foo.' ..etc The paragraph tag and white space need to be excluded. The regex will go into the git diff --word-diff-regex='insert regex here' which uses bash Thanks EDIT git uses POSIX for it's regex. Look arounds aren't supported

Why is my django url regex not working

I want my url to accept 0 or more digits(positive or negative integers), I mean it should match '/','/0',...,'/9' as well as '/-9','/-88' etc. This is the regex I am using ^([-]?[0-9]*)/$ . It works for all urls except '/', what is the problem with this regex? EDIT: This is my urlpatterns in urls.py in project directory: urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'',include('basecalendar.urls'), name='date'), ] and this is urlpattern for basecalendar urlpatterns=[

Regex to extract emails in WebHarvy

I am trying to work up a Regex to extract email addresses off a WP directory using WebHarvy (.NET) The emails could be in multiple formats, using dots and underscores and so I tried the following expressions (\w+|\w+(\W|\.)\w+)@\w+.\w+ \w.+|\w+\S\w+@\w+\.\w+ Though they seem to be working in the Regexstorm tester, when I am using them in WebHarvy, they are only extracting the part preceding the @ Please advise

Regex Using sed to extract element content of an XML file

Well, using sed I'm trying to extract everything between <Transport_key> and </Transport_key> from input files like this: <?xml version="1.0" encoding="utf-8"?> <Envelope xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <Header> <Security> <Transport_key> <EncryptedKey Id="TK" xmlns="http://www.w3.org/2001/04/xmlenc#"> <EncryptionMethod Algorithm=

How do I escape a certain word in a URL with Google Analytics regex?

I'm trying to set up a regex to escape a certain word in a URL with Google Analytics goals. Currently the URL path is: /pricing/mls /pricing/armls /pricing/armls/bundle/5 Step 1 is static, and will always stay that way but step 2 has over 80 different possibilities. I wanted to set up a Regex that will specifically escape "mls". Using the (.*) would also grab the mls page which I'm trying to escape. Currently my regex looks like this: ^\/pricing\/mls$ ^\/pricing\/(.*) this is where I'm tr

Regex How do I ignore JAVA tests in Coverity Connect analysis result?

I use Coverity to scan my project for security issues. What I would like to know is how to exclude any java test (NOTE: both integration and unit) from the analysis results that are available after a defect commit. I did use maven to build the project and I excluded Unit tests using the flag -Dmaven.skip.test=true. Though that made Coverity not scanning unit tests, it still makes it scan integration ones. All the integration tests in my project contain the word "Test" in the file titles. T

Search and modify with one regex

Say, we have HTML-page, containing links: a href="katalog/koshelki-i-klatchi/muzhskaya-sumka-planshet-polo-optom1" a href="katalog/koshelki/kozhanaya-sumka-jeep-optom1" I need to search using regex one time only (in one search query), and I want output to be: koshelki-i-klatchi/muzhskaya-sumka-planshet-polo-optom1 koshelki/kozhanaya-sumka-jeep-optom1 What would regular expression for this task be like?

Regex Powershell string -replace remember first argument value?

I'm currently working on a powershell script where I have to replace all the expressions with "[A-Z]=" to "(first expression's letter):" For example "A=" would become "E=", "Z=" -> "Z:" etc.. So in the end I want to remember part of the first argument and paste it to the second argument. Is there any efficient way to do this ? $quotaTXT3 = $quotaTXT2 -replace '[A-Z]=', '[A-Z]:'

Regex Matching $ (dollar sign) words in Dart regular expression

I want to match all dollar sign words in the text. For example, "Hello $VARONE this is $VARTWO", would match $VARONE and $VARTWO. The regex should be /\$(\w+)/g but when I use this in Dart with the compiler in DartPad (https://dartpad.dartlang.org/) the words are not matched. void main() { final variableGroupRegex = new RegExp(r"/\$(\w+)/g"); Iterable<Match> matches = variableGroupRegex.allMatches("Hello \$VARONE this is \$VARTWO"); for (Match match in matches) { print(

Regex How to compare variable with parsed email in Mongoose query?

NOT [DUPLICATE]: This question is NOT been previously answered and been unfairly downvoted. The two marked answers from different sources are about distinct things. Combined, they may partially answer to some degree but they don't address the very specific case of what is been asked here (e.g. None of them explains how to parse email before comparing to variable). I need to extract the first half of email, compare it to a string variable, and then execute the query with mongoose. I found many p

Regex two optional with a starting sign

hello(?:-(?:1(one))?(?:2(two))?)?- i accept those patterns hello- hello-1one- hello-2two- hello-1one2two- my problem is this pattern hello-- is accepted too and i want to make ?:- to be required when 1one or 2two exists only how to do?

Regex Regular expression to get everything between two characters/strings

I have been trying to use regular expression to extract data from the following strings LTE_LTE_FSD9167__P_Airport1 I want to extract the 7 digit sitecode(FSD9167) from the above string. RUR1251__S_KhooNaiWala I want to extract 7 digit sitecode(RUR1251) from above string. For LTE_LTE case I wrote LTE_LTE_([^_;]+).* but it selects the whole string including not the required text only.

Unable to REGEXP_MATCH in source / medium

I want to regexp_match source/medium "google / cpc" as Paid Search, but Campaign cannot contains shopping|gdn|whoop|... in Google Data Studio. Example: Source/Medium: google / cpc Campaign: ec_ao_core_search_brand_example I tried the code below but it gives me always as "NA", can you help? CASE WHEN REGEXP_MATCH(Source/Medium, "((?i).*google / cpc).*") AND REGEXP_MATCH(Campaign, "((!~).shopping|gdnalwayson|gdn|not set|whoop|dynamic|display|smart shopping).") THEN "Paid Search" ELSE "N

Regex Regular expression to search in a specific file sheet

I am trying to use regular expressions in VBA to search in a specific file sheet. I am trying to filter certain data. I believe there is an issue with how to set my worksheet to the required value. Dim RE As Object Dim LSearchRow As Long Dim LCopyToRow As Long Dim ws As Worksheet Set ws = Worksheets("Values") On Error GoTo Err_Execute Set RE = CreateObject("vbscript.regexp") RE.Pattern = "(T04)" RE.Ignorecase = True LSearchRow = 5 'Start search in row 5 LCopyToRow = 3 'Start copying data t

Regex Apache mod_rewrite mapping path to parameters

I'm moving over from IIS to Apache (on Windows) and struggling with adapting a rewrite rule (using Helicon ISAPI_Rewrite 3 in IIS). The rule maps what looks like a directory structure path back into a set of query string parameters. There could be any number of parameters in the path. E.g. /basket/param1/value1/param2/value2/param3/value3 ...and so on... Becomes... /basket?param1=value1&param2=value2&param3=value3 ...and so on... Rule in ISAPI_Rewrite: # This rule simply reverts paramet

  1    2   3   4   5   6  ... 下一页 最后一页 共 336 页