Search Results

Search found 4498 results on 180 pages for 'expression'.

Page 41/180 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Regular Expression to match IP address + wildcard

    - by Ed Woodcock
    Hey guys I'm trying to use a RegularexpressionValidator to match an IP address (with possible wildcards) for an IP filtering system. I'm using the following Regex: "([0-9]{1,3}\\.|\\*\\.){3}([0-9]{1,3}|\\*){1}" Which works fine when running it in LINQPad with Regex.Matches, but doesn't seem to work when I'm using the validator. Does anyone have a suggestion as to either a better Regex or why it would work in test but not in situ? Cheers, Ed

    Read the article

  • Regular Expression issue

    - by Christian Sciberras
    I have the following URL structure which I need to match to and get the particular id from: /group/subgroup/id-name In short, I need to translate a URL like the following: /Blue Products/Dark Blue/5-Blue_Jelly To: /?pagename=Blue Products&model=5 IMPORTANT: I don't need to match group, I already have group. Example code: <?php foreach($cats as $cat) $cmd->rewrite('/\/'.$cat.'\/unused\/(ID)-unused\//','/?pagename='.$cat.'&model=%ID%'); ?> Edit: This is the completed code: if($groups->count()){ $names=array(); foreach($groups->rows as $row) $names[]=preg_quote($row->group); $names=implode('|',$names); $regex='('.$names.')/([^/]+)/([0-9]{1,})-([^/]+)/?$'; CmsHost::cms()->rewrite_url($regex,'index.php?pagename=Products',true); }

    Read the article

  • .Net Regular Expression

    - by xzerox
    Alright so I want to grab the information on a website thats between [usernames] and [/usernames] I know how to get the string but how would I use regex to only have the information in the middle. Remember I am going to be having more then one thing on the page.

    Read the article

  • Regular expression test can't decide between true and false (JavaScript)

    - by nw
    I get this behavior in both Chrome (Developer Tools) and Firefox (Firebug). Note the regex test returns alternating true/false values: > var re = /.*?\bbl.*\bgr.*/gi; undefined > re /.*?\\bbl.*\\bgr.*/gi > re.test("Blue-Green"); true > re.test("Blue-Green"); false > re.test("Blue-Green"); true > re.test("Blue-Green"); false However, testing the same regex as a literal: > /.*?\bbl.*\bgr.*/gi.test("Blue-Green"); true > /.*?\bbl.*\bgr.*/gi.test("Blue-Green"); true > /.*?\bbl.*\bgr.*/gi.test("Blue-Green"); true > /.*?\bbl.*\bgr.*/gi.test("Blue-Green"); true I can't explain this and it's making debugging very difficult. Can anyone explain this behavior?

    Read the article

  • Why this C# Regular Expression crashes my program?

    - by robert_d
    using System; using System.IO; using System.Net; using System.Text.RegularExpressions; namespace Working { class Program4 { static string errorurl = "http://www.realtor.ca/propertyDetails.aspx?propertyId=8692663"; static void Main(string[] args) { string s; s = getWebpageContent(errorurl); s = removeNewLineCharacters(s); getFields(s); Console.WriteLine("End"); } public static void getFields(string html) { Match m; string fsRE = @"ismeasurement.*?>.*?(\d+).*?sqft"; m = Regex.Match(html, fsRE, RegexOptions.IgnoreCase); } private static string removeNewLineCharacters(string str) { string[] charsToRemove = new string[] { "\n", "\r" }; foreach (string c in charsToRemove) { str = str.Replace(c, ""); } return str; } static string getWebpageContent(string url) { WebClient client = new WebClient(); client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)"); Stream data = client.OpenRead(url); StreamReader reader = new StreamReader(data); string s = reader.ReadToEnd(); data.Close(); reader.Close(); return s; } } } This program hangs. It runs correctly when I remove RegexOptions.IgnoreCase option or when I remove call to removeNewLineCharacters() function. Could someone tell me what is going on, please?

    Read the article

  • RegEx expression to find a href links and add NoFollow to them

    - by Rodney
    I am trying to write a RegEx rule to find all a href HTML links on my webpage and add a 'rel="nofollow"' to them. However, I have a list of URLs that must be excluded (for exmaple, ANY (wildcards) internal link (eg. pokerdiy.com) - so that any internal link that has my domain name in is excluded from this. I want to be able to specify exact URLs in the exclude list too - for example - http://www.example.com/link.aspx) Here is what I have so far which is not working: (]+)(href="http://.*?(?!(pokerdiy))[^]+) If you need more background/info you can see the full thread and requirements here (skip the top part to get to the meat): http://www.snapsis.com/Support/tabid/601/aff/9/aft/13117/afv/topic/afpgj/1/Default.aspx#14737

    Read the article

  • Regular Expression with Names and Emails

    - by Nina
    I am having a problem with regular expressions at the moment. What I'm trying to do is that for each line through the iteration, it checks for this type of pattern: Lastname, Firstname If it finds the name, then it will take the first letter of the first name, and the first six letters of the lastname and form it as an email. I have the following: $checklast = "[A-z],"; $checkfirst = "[A-z]"; if (ereg($checklast, $parts[1])||ereg($checkfirst, $parts[2])){ $first = preg_replace($checkfirst, $checkfirst{1,1}, $parts[2]); print "<a href='mailto:[email protected];'> $parts[$i] </a>"; } This one obviously broke the code. But I was initially attempting to find only the first letter of the firstname and then after that the first six letters of the lastname followed by the @email.com This didn't work out too well. I'm not sure what to do at this point. Any help is much appreciated.

    Read the article

  • SFINAE + sizeof = detect if expression compiles

    - by FredOverflow
    I just found out how to check if operator<< is provided for a type. template<class T> T& lvalue_of_type(); template<class T> T rvalue_of_type(); template<class T> struct is_printable { template<class U> static char test(char(*)[sizeof( lvalue_of_type<std::ostream>() << rvalue_of_type<U>() )]); template<class U> static long test(...); enum { value = 1 == sizeof test<T>(0) }; typedef boost::integral_constant<bool, value> type; }; Is this trick well-known, or have I just won the metaprogramming Nobel prize? ;) EDIT: I made the code simpler to understand and easier to adapt with two global function template declarations lvalue_of_type and rvalue_of_type.

    Read the article

  • Expression Expected

    - by coffeeaddict
    I cannot figure out what I'm doing wrong syntactically here: function PlaceOrder(button) { var isValid; if (buttonIsSelected()) { showsMessage(btn, "showTestMessage2); isValid = true; } else { Page_ClientValidate(); if (Page_IsValid) { showMessage(btn, "testMessage"); isValid = true; } } return isValid; // error happens here }

    Read the article

  • How do I not include part of a regular expression

    - by Axilus
    I'm pretty new to using regexes and I can figure out how I would go about extracted a specific number from a string. Suppose the string was any amount of whitespace or random text and somewhere within it is this, "Value: $1000.00." In order to retrieve that value I am currently using this: string value = Convert.ToString(Regex.Match(BodyContent, @"Value:[ \t]*\$?\d*(\.[0-9]{2})?", RegexOptions.Singleline)); So the variable 'value' now has, "Value: $1000.00" stored in it. My question is, using Regex is there a way to use 'Value:' to find the number value but only store the actual number value (i.e. 1000.00) in the 'value' variable?

    Read the article

  • Regular Expression: Allow letters, numbers, and spaces (with at least one letter or number)

    - by makeee
    I'm currently using this regex ^[A-Z0-9 _]*$ to accept letters, numbers, spaces and underscores. I need to modify it to require at least one number or letter somewhere in the string. Any help would be appreciated! This would be for validating usernames for my website. I'd actually like to support as many characters as I can, but just want to ensure that I prevent code injection and that characters will display fine for all users. So I'm definately open to regex validation suggestions that would support a wider set of characters.

    Read the article

  • javascript validate zip regular expression

    - by phil
    It's not working. Probably it's syntax error, but I can't figure it out. <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script> pattern=/^[0-9]{5}$/; if (!pattern.test($('#zip').val)) {$('#zip').append($('<p>',{html: zip is invalid}));} </script> zip (US only): <input type="text" name='zip' id='zip' maxlength="5">

    Read the article

  • string substitution regular expression not working in tcl

    - by Puneet Mittal
    i am trying to replace all the special characters including white space, hyphen, etc, to underscore, from a string variable in tcl. I wrote the code below but it doesn't seem to be working. set varname $origVar puts "Variable Name :>> $varname" if {$varname != ""} { regsub -all {[\s-\]\[$^?+*()|\\%&#]} $varname "_" $newVar } puts "New Variable :>> $newVar" one issue is that, instead of replacing the string in $varname, it is replacing the data inside $origVar. No idea why, and also i read the example code (for proper syntax) in my tcl book and according to that it should be something like this regsub -all {[\s-][$^?+*()|\\%&#]} $varname "_" newVar so i used the same syntax but it didn't work and gave the same result as modifying the $origVar instead of required $varname value.

    Read the article

  • Perl Regular Expression [] for <>

    - by bmucklow
    So I am trying to read an XML file into a string in Perl and send it as part of a SOAP message. I know this is not ideal as there are methods for SOAP sending files, however, I am limited to having to use the SOAP that is set up, and it is not set up for sending with file support. Therefore I need to parse out the markup tags < and replace them with []. What is the best way to do this?

    Read the article

  • PHP regular expression subpattern behaviour

    - by codecowboy
    I want to match both the src and title attributes of an image tag: pattern: <img [^>]*src=["|\']([^"|\']+["|\'])|title=["|\']([^"|\']+) target: <img src="http://someurl.jpg" class="quiz_caption" title="Caption goes here!"> This pattern gives me one unwanted match, title="content", and the match I actually want which is the value between the quotes after the word 'title', i.e 'content'. So, my matches are: <img src="http://someurl.jpg http://someurl.jpg title="Caption goes here!" Caption goes here! Is there a way to avoid the third of these matches? I'm using PCRE in PHP 5.2.x

    Read the article

  • ruby parametrized regular expression

    - by astropanic
    I have a string like "{some|words|are|here}" or "{another|set|of|words}" So in general the string consists of an opening curly bracket,words delimited by a pipe and a closing curly bracket. What is the most efficient way to get the selected word of that string ? I would like do something like this: @my_string = "{this|is|a|test|case}" @my_string.get_column(0) # => "this" @my_string.get_column(2) # => "is" @my_string.get_column(4) # => "case" What should the method get_column contain ?

    Read the article

  • Find a regular expression that matches a string?

    - by Mirai
    I need a model for finding all of the regular expressions that would match a particular string. Basically, I need an algorithm for doing what I do to generate a regex search string from some pattern. My purpose for this to create a list of potential regular expressions from a selection of text and order that list from least specific (i.e. string of characters with abitrary length) to most specific (i.e. the string itself) to be used in text editor.

    Read the article

  • Php regular expression to match a div

    - by Thoman
    Hello This is mycode <?php /** * @author Joomlacoders * @copyright 2010 */ $url="http://urlchecker.net/html/demo.html"; $innerHtml=file_get_contents($url); //echo $innerHtml; preg_match_all("{\<div id='news-id-.*d'\>(.*)\</div\>}",$innerHtml,$matches); //<div id='news-id-160346'> var_dump($matches); ?> I want find all content in div id='news-id-160346'. Please help me

    Read the article

  • Javascipt Regular Expression

    - by Ghoul Fool
    Having problems with regular expressions in JavaScript. I've got a number of strings that need delimiting by commas. Unfortunately the sub strings don't have quotes around them which would make life easier. var str1 = "Three Blind Mice 13 Agents of Cheese Super 18" var str2 = "An Old Woman Who Lived in a Shoe 7 Pixies None 12" var str3 = "The Cow Jumped Over The Moon 21 Crazy Cow Tales Wonderful 9" They are in the form of PHRASE1 (Mixed type with spaces") INTEGER1 (1 or two digit) PHRASE2 (Mixed type with spaces") WORD1 (single word mixed type, no spaces) INTEGER2 (1 or two digit) so I should get: result1 = "Three Blind Mice, 13, Agents of Cheese, Super, 18" result2 = "An Old Woman Who Lived in a Shoe, 7, Pixies, None, 12" result3 = "A Cow Jumped Over The Moon, 21, Crazy Cow Tales, Wonderful, 9" I've looked at txt2re.com, but can't quite get what I need and ended up delimiting by hand. But I'm sure it can be done, albeit someone with a bigger brain. There are lots of examples of regEx but I couldn't find any to deal with phrases; so I was wondering if anyone could help me out. Thank you.

    Read the article

  • VB.net Regular Expression

    - by xzerox
    Alright so I want to grab the information on a website thats between [usernames] and [/usernames] I know how to get the string but how would I use regex to only have the information in the middle. Remember I am going to be having more then one thing on the page.

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >