Search Results

Search found 3825 results on 153 pages for 'regex negation'.

Page 14/153 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • PHP - preg_match_all - iCalendar - REGEX

    - by aSeptik
    Hi All guys! ;-) i need help with creating a regex for putting all values into an array! assuming we have a huge file full of theese: Classic iCalendar style: so we know that each segment start with BEGIN:VEVENT and end with END:VEVENT ... END:VEVENT BEGIN:VEVENT UID:e3cafdf3-c5c7-427e-b8c3-653015e9321a SUMMARY:Some Text Here DESCRIPTION:Some Text Here\n555-555-555 ORGANIZER;CN=Some/Text/Here DTSTART;TZID="Some/Text/Here":20100802T190000 DTEND;TZID="Some/Text/Here":20100802T193000 STATUS:CONFIRMED CLASS:PUBLIC X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY TRANSP:OPAQUE X-MICROSOFT-DISALLOW-COUNTER:TRUE DTSTAMP:20100423T021222Z SEQUENCE:1 END:VEVENT BEGIN:VEVENT ... by using preg_match_all that i think is the best choice for doing this, what's the regex that can hold all theese values into array!? PS: between segments there are no line break this is just for example! thank's to All for the time! Regards Luca Filosfi

    Read the article

  • PHP Fomatting Regex - BBCode

    - by Wayne
    To be honest, I suck at regex so much, I would use RegexBuddy, but I'm working on my Mac and sometimes it doesn't help much (for me). Well, for what I need to do is a function in php function replaceTags($n) { $n = str_replace("[[", "<b>", $n); $n = str_replace("]]", "</b>", $n); } Although this is a bad example in case someone didn't close the tag by using ]] or [[, anyway, could you help with regex of: [[ ]] = Bold format ** ** = Italic format (( )) = h2 heading Those are all I need, thanks :) P.S - Is there any software like RegexBuddy available for Mac (Snow Leopard)?

    Read the article

  • Could someone please explain this REGEX?

    - by NJTechGuy
    if($title =~ s/(\s|^|,|\/|;|\|)$replace(\s|$|,|\/|;|\|)//ig) $title can be a set of titles ranging from President, MD, COO, CEO,... $replace can be (shareholder), (Owner) or the like. I keep getting this error. I have checked for improperly balanced '(', ')', no dice :( Unmatched ) in regex; marked by <-- HERE in m/(\s|^|,|/|;|\|)Owner) <-- HERE (\s|$|,|/|;|\|)/ If you could tell me what the regex does, that had be awesome. It strips those symbols is it? Sorry long day at work. Thanks guys!

    Read the article

  • c# Regex on XML string handler

    - by Dan Sewell
    Hi guys. Trying to fiddle around with regex here, my first attempt. Im trying to extract some figures out of content from an XML tag. The content looks like this: www.blahblah.se/maps.aspx?isAlert=true&lat=51.958855252721&lon=-0.517657021473527 I need to extract the lat and long numerical vales out of each link. They will always be the same amount of characters, and the lon may or may not have a "-" sign. I thought about doing something like this below: (The string in question is in the "link" tag): var document = XDocument.Load(e.Result); if (document.Root == null) return; var events = from ev in document.Descendants("item1") select new { Title = (ev.Element("title").Value), Latitude = Regex.xxxxxxx(ev.Element("link").Value, @"lat=(?<Lat>[+-]?\d*\.\d*)", String.Empty), Longitude = Convert.ToDouble(ev.Element("link").Value), }; foreach (var ev in events) { do stuff } Many thanks!

    Read the article

  • How to extract text using regex in Actionscript?

    - by Lost_in_code
    In the HTML below: <a href="link1.php">1</a><a href="link2.php">2</a><a href="link3.php">3</a> How do I extract link1.php,link2.php,link3.php and push them into an array using regex? (There could be N number of <a> tags in the text) [Edit] I'm aware the regex for this is something like href="([^"])*". But I'd like to know how to go about this in Actionscript. Specifically, how can they be pushed into an array in Actionscript?

    Read the article

  • Perl Regex Output only characters that can be used as unix filename

    - by Jeff Balinsky
    I wrote a basic mp3 organizing script for myself. I know the power of regex but I suck with the syntax I have the line $outname = "/home/jebsky/safehouse/music/mp3/" . $inital . "/" . $artist . "/" . $year ." - ". $album . "/" . $track ." - ". $artist ." - ". $title . ".mp3"; All I want is a regex to change $outname so that any non safe for filename characters get replaced by an underscore Thanks Jeff

    Read the article

  • Why does my Perl regex complain about "Unmatched ) in regex"?

    - by NJTechGuy
    if($title =~ s/(\s|^|,|\/|;|\|)$replace(\s|$|,|\/|;|\|)//ig) $title can be a set of titles ranging from President, MD, COO, CEO,... $replace can be (shareholder), (Owner) or the like. I keep getting this error. I have checked for improperly balanced '(', ')', no dice :( Unmatched ) in regex; marked by <-- HERE in m/(\s|^|,|/|;|\|)Owner) <-- HERE (\s|$|,|/|;|\|)/ If you could tell me what the regex does, that would be awesome. Does it strip those symbols? Thanks guys!

    Read the article

  • A PHP regex to extract php functions from code files

    - by user298593
    I'm trying to make a PHP regex to extract functions from php source code. Until now i used a recursive regex to extract everything between {} but then it also matches stuff like if statements. When i use something like: preg_match_all("/(function .(.))({([^{}]+|(?R))*})/",$this-data,$matches2); It doesn't work when there is more than 1 function in the file (probably because it uses the 'function' part in the recursiveness too). Is there any way to do this? Example file: <?php if($useless) { echo "i don't want this"; } function bla($wut) { echo "i do want this"; } ?> Thanks

    Read the article

  • Regex to validate initials

    - by iar
    I'm looking for a regex to validate initials. The only format I want it to allow is: (a capital followed by a period), and that one or more times Valid examples: A. A.B. A.B.C. Invalid examples: a. a A A B A B C AB ABC Using The Regulator and some websites I have found the following regex, but it only allows exactly one upper (or lower!) case character followed by a period: ^[A-Z][/.]$ Basically I only need to know how to force upper case characters, and how I can repeat the validation to allow more the one occurence of an upper case character followed by a period.

    Read the article

  • Need help with this Regex + UrlRewriter.NET please :)

    - by Pure.Krome
    Previously, on StackOverflow ... (Summarized) I need to capture all requests, for a particluar subdomain .. and rewrite their destination. Now, the trick to determining the host via regex was solved. Now, i need to make sure all requests to the root index page is rewritten, but i can't figure out the correct regex to find the 'homepage' / website root. this is what i have.... <if header="HTTP_HOST" match="^foo\.mydomain\.com\.au(?::\d+)?/?$"> <!-- snip some other rewrites, eg./buying/product -> ~/Pages/Foo/Bar.aspx --> <rewrite url="^/$" to="~/Pages/SomeWeirdFolder/Home.aspx" processing="stop"/> </if> Now if one of the rewrites were not found, then it falls through and continues. So .. can anyone please help?

    Read the article

  • Regex: absolute url to relative url (C#)

    - by splatto
    I need a regex to run against strings like the one below that will convert absolute paths to relative paths under certain conditions. <p>This website is <strong>really great</strong> and people love it <img alt="" src="http://localhost:1379/Content/js/fckeditor/editor/images/smiley/msn/teeth_smile.gif" /></p> Rules: - If the url contains "/Content/" I would like to get the relative path - If the url does not contain "/Content/", it is an external file, and the absolute path should remain Regex unfortunatley is not my forte, and this is too advanced for me at this point. If anyone can offer some tips I'd appreciate it. Thanks in advance.

    Read the article

  • Multiple delimiters using Regex.Split in C#

    - by Arthur Frankel
    Let's say you need to split a string by various delimiters including newline (/r, /n) and a few other 'special' character strings. For example: This is a sample %%% text &&& that I would like to split %%% into an array. I would like the following in the resulting string array (contents via index) [0]This is a sample [1]text [2]that I would [3]like to split [4]into an array. I would like to use C# Regex.Split() function. What is the regex expression to match on all of my delimiters? Thanks in advance

    Read the article

  • RegEx to match a pattern and exclude a part of the string

    - by rojanu
    Hi, I have got some strings to be matched via RegEx. We have a java application which reads the regex from a config file and takes two groups of strings, number of which are specified in the same config. E.g. CustomAction.523274ca945f.dialogLabel=Executing Custom Code... will be matched with (?m)^(?!#)\s*(\S*)\s*=\s*(\S*.*) What I need is to pick the first group "CustomAction.523274ca945f.dialogLabel" and exclude the random string in the middle so I end up with something like "CustomAction.dialogLabel" or "CustomAction..dialogLabel" well any other combination but the random string. Thanks

    Read the article

  • How do I format this regex so it will work in fail2ban?

    - by chapkom
    I've just installed fail2ban on my CentOS server in response to an SSH brute force attempt. The default regular expressions in fail2ban's sshd.conf file do not match any entries in audit.log, which is where SSH seems to be logging all connection attempts, so I am trying to add an expression that will match. The string I am trying to match is as follows: type=USER_LOGIN msg=audit(1333630430.185:503332): user pid=30230 uid=0 auid=500 subj=user_u:system_r:unconfined_t:s0-s0:c0.c1023 msg='acct="root": exe="/usr /sbin/sshd" (hostname=?, addr=<HOST IP>, terminal=sshd res=failed)' The regular expression I am attempting to use is: ^.*addr=<HOST>, terminal=sshd res=failed.*$ I've used regextester.com and regexr to try to build the regex. The testers give me a match for this regex:^.*addr=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}, terminal=sshd res=failed.*$ but fail2ban-regex complains if I don't use the <HOST> tag in the regex. However, using ^.*addr=<HOST>, terminal=sshd res=failed.*$ gives me 0 matches. At this point, I am totally stuck and I would greatly appreciate any assistance. What am I doing wrong in the regex I am trying to use?

    Read the article

  • REGEX HELP: SUBDOMAIN CHECK

    - by NoviceCoding
    Hey I have a form where the person enters the subdomain like value.google.com and the entry would be "valid" I want to run a regex check (I am absolutely horrible at regex) that does the following: First Character: Cannot be symbol Middle Characters: a-z, A-Z, and symbols - and . ONLY Last character: Cannot be a symbol I want it to spit out false if it fails the test. Can anyone help me out with this? Thanks! Also any other limitations do you guys think should be in there?

    Read the article

  • Regex help -- cleaning up whitespace -- Java

    - by FarmBoy
    I'm trying to view the text of HTML files in a reasonable way. After I remove all of the markup and retain only the visible text, I obtain a String that looks something like this: \n\n\n\n \n\n\n \n\n \n Title here \n\n\n \n\n \n\n Menu Item 1 \n\n \n\n Menu Item 2 \n\n\n \n\n you get the point. I would like to use String.replaceAll(String regex, String regex) to replace any whitespace substring that contains more than two occurances of \n with "\n\n". Any ideas?

    Read the article

  • Replace text in string with delimeters using Regex

    - by user1057735
    I have a string something like, string str = "(50%silicon +20%!(20%Gold + 80%Silver)| + 30%Alumnium)"; I need a Regular Expression which would Replace the contents in between ! and | with an empty string. The result should be (50%silicon +20% + 30%Alumnium). If the string contains something like (with nested delimiters): string str = "(50%silicon +20%!(80%Gold + 80%Silver + 20%!(20%Iron + 80%Silver)|)| + 30%Alumnium)"; The result should be (50%silicon +20% + 30%Alumnium) - ignoring the nested delimiters. I've tried the following Regex, but it doesn't ignore the nesting: Regex.Replace(str , @"!.+?\|", "", RegexOptions.IgnoreCase);

    Read the article

  • RegEx/Javascript validation: Don't allow comma as a valid character

    - by baldwingrand
    I'm doing Javascript validation on my number fields. I'm using RegEx to do this - first time RegEx user. I need the user to only enter numbers and decimals, but not commas. (i.e. 3600.00 is okay, but 3,600.00 is not). I can't figure out how to eliminate the commas as an accepted character. Any help is appreciated. Thanks! var filter = /^([0-9])/; if (!filter.test(txtItemAmount.value)) { msg += "Item amount must be a number.\n"; txtItemAmount.focus }

    Read the article

  • asp.net regex to find anchor tags and replace their url

    - by ace
    Hi -i'm trying to find all the anchor tags and appending the href value with a variable. for example <a href="/page.aspx">link</a> will become <a href="/page.aspx?id=2"> <A hRef='http://www.google.com'><img src='pic.jpg'></a> will become <A hRef='http://www.google.com?id=2'><img src='pic.jpg'></a> I'm able to match all the anchor tags and href values using regex, then i manually replace the values using string.replace, however i dont think its the efficient way to do this. Is there a solution where i can use something like regex.replace(html,newurlvalue)

    Read the article

  • Gruber URL Regex tweak to capture "domain.com"

    - by mootymoots
    I found an updated version of John Gruber's regex for url matching in this post by user GianPac, which states it's been adapted to recognize url without protocol or the www part: (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.-]+[.][a-z]{2,4}/?)(?:[^\s()<]+|(([^\s()<]+|(([^\s()<]+)))))(?:(([^\s()<]+|(([^\s()<]+))))|[^\s`!()[]{};:'\".,<?«»“”‘’])) Whilst this works in most cases, I found it does not match "google.com". It does match "google.comm" and "google.co.uk", so this must be a small oversight. The trouble is, I literally hate regex. It's the bane of my life. I just want to try and tweak this one more time to allow for "google.com" - can anyone throw me a pointer? I (think) it's something to do with this part of the code: +[.][a-z]{2,4}/?) ?

    Read the article

  • Regex to match CSV file nested quotes

    - by user361970
    Hi, I know this has been discussed a million times. I tried searching through the forums and have seen some close regex expressions and tried to modify them but to no avail. Say there is a line in a csv file like this: "123", 456, "701 "B" Street", 910 Is there an easy regex to detect "B" (since its a non-escaped set of quotes within the normal CSV quotes) and replace it with something like \"B\" ? The final string would end up looking like this: "123", 456, "701 \"B\" Street", 910 Help would be greatly appreciated!

    Read the article

  • Regex problem ...

    - by carlos
    hello i have the next regex Dim origen As String = " /c /p:""c:\mis doc umentos\mis imagenes construida\archivo.txt"" /cid:45 423 /z:65 /a:23 /m:39 /t:45rt " Dim str As String = "(^|\s)/p:""\w:(\\(\w+[\s]*\w+)+)+\\\w+.\w+""(\s|$)" Dim ar As Integer Dim getfile As New Regex(str) Dim mgetfile As MatchCollection = getfile.Matches(origen) ar = mgetfile.Count When i evaluate this it works, and gets the /p:""c:\mis doc umentos\mis imagenes construida\archivo.txt"" that basically is the path to a file. But if I change the origen string to Dim origen As String = " /c /p:""c:\mis doc umentos\mis imagenes construida\archivo.txt""/cid:45 423 /z:65 /a:23 /m:39 /t:45rt " Check that the end of the file is follow by "/cid:45" whitchs makes de patter invalid, but insted of getting a mgetfile.count = 0 the program is block, if i make a debug I got a property evaluation failed. Thanks for your comments !!!

    Read the article

  • python regex for repeating string

    - by Lars Nordin
    I am wanting to verify and then parse this string (in quotes): string = "start: c12354, c3456, 34526;" //Note that some codes begin with 'c' I would like to verify that the string starts with 'start:' and ends with ';' Afterward, I would like to have a regex parse out the strings. I tried the following python re code: regx = r"V1 OIDs: (c?[0-9]+,?)+;" reg = re.compile(regx) matched = reg.search(string) print ' matched.groups()', matched.groups() I have tried different variations but I can either get the first or the last code but not a list of all three. Or should I abandon using a regex?

    Read the article

  • Regex to String generation

    - by Mifmif
    Let's say that we have a regex and an index i , if we suppose that the set of string that match our regex are sorted in a lexicographical order, how could we get the i element of this list ? Edit : I added this simple example for more explanation : input : regex="[a-c]{1,2}"; index=4; in this case the ordered list of string that matches this regex contains those elements : a aa ab ac b ba bb bc c ca cb cc output : the 4th element which is ac ps: it's known that the string list that match the regex have infinite element, this doesn't have an impact on the proccess of extracting the element in the given index.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >