Search Results

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

Page 8/153 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • smaller date regex

    - by Jeremy
    I have a regex used to validate dates: ^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$ Works really well, but I am using it all over the place with asp.net regex validators and I want to minimize it so I can reduce page size. It works with dd/mm/yyyy format and handles leap years. I'm looking for a more concise regex statement.

    Read the article

  • C++0x regex in GCC

    - by rwallace
    The following code: #include <regex> using namespace std; (snippage) regex_search(s, m, re); works in Microsoft C++, but GCC 4.4.3 gives the following error message: /usr/include/c++/4.4/tr1_impl/regex:2255: warning: inline function ‘bool std::regex_search(_Bi_iter, _Bi_iter, std::match_results<_Bi_iter, _Allocator&, const std::basic_regex<_Ch_type, _Rx_traits&, std::regex_constants::match_flag_type) [with _Bi_iter = __gnu_cxx::__normal_iterator, std::allocator , _Allocator = std::allocator, std::allocator , _Ch_type = char, _Rx_traits = std::regex_traits]’ used but never defined Of course it wouldn't surprise me if regex were simply one of the C++0x features still on the to-do list for GCC, but what I'm scratching my head over is, in that case, why does it happily take the include directive, variable declarations etc. and only trip over the function call (which it even seems to understand). Is there something I'm missing?

    Read the article

  • Regex in MySql - replace between Tags including Tags

    - by user998163
    I have a text like: [lang_de]Content in German[/lang_de][lang_en]Content in English[/lang_en]. I want to replace all text between [lang_en] and [/lang_en] including the opening and closing language tag. This is my current regex: UPDATE wp_posts SET post_content = '" . addslashes(preg_replace("/[lang_en](.*)[\/lang_en]/", '', $row['post_content'])) . "' WHERE ID = " . $row['ID'] With this regex, I do not get a valid results. It also replaces in html tags and so on. What would be the correct regex?

    Read the article

  • 301 Redirects, and the correct regex to go with it

    - by Tisch
    Hi Guys, I have several URLs that I want to redirect to the same place, however these are dynamic URLs. The structure is something like this: http://www.mysite.com/declaration/list?[query_string] What I think would be ideal for this situation is to use some regex in my .htaccess file to redirect all these links to the sites home page. I was wondering if someone could help me with the regex for this situation. So far, I have this, but it doesn't work: RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^/declaration/list$ http://www.mysite.com/$ [R=301,L] My regex is weak to say the least, something I want to, and am trying to learn. Thanks in advance. Tom

    Read the article

  • Javascript regex only matching entire url as typing

    - by dt
    I'm trying to use javascript to find all URLs in a textarea as the person is typing (onkeyup). The problem that I'm having is in finding a regex to match the entire URL, I need it only to match all the URL's in the text area that are complete URLs. All of the existing regex expressions that I find through Google and through my own experiementing seem to match as soon as the user has typed the first part of the pattern. So, for example, if I'm typing and then start to type http://w, all of a sudden, it will match. I need to find a regex that will match and return an array of all the urls that are in the textarea, while also not matching unless the person has completed typing the full URL. Hopefully that makes sense! Thank you!

    Read the article

  • Is it possible to use Regex through Hexadecimal to find email addresses

    - by LukeJenx
    Not sure if this is even possible but I have been looking at using Regex to get an email address that is in Hex. Basically this is to build up some of my automated forensic tools but I am having problems on making a suitable Regex algorithm. Regex for email: /^([a-z0-9_.-]+)@([\da-z.-]+).([a-z.]{2,6})$/ Hex values: @ = 40 . = 2E .com = 636f6d _ = 5f A/a = 41/61 [1] Z/z = 5a/7a - = 2d This is what I have got at the moment (it only takes into account lower case and .com). But it doesn't work! Have I messed something simple up? "/^([61-7a]+)40([61-7a]+)23(636f6d)$/" [1] I know email can only be lower case but I need to take uppercase into account too.

    Read the article

  • Regex - replace only last part of an expression

    I'm attempting to find the best methodology for finding a specific pattern and then replace the ending portion of the pattern. Here is a quick example (in C#): //Find any year value starting with a bracket or underscore string patternToFind = "[[_]2007"; Regex yearFind = new Regex(patternToFind); //I want to change any of these values to x2008 where x is the bracket or underscore originally in the text. I was trying to use Regex.Replace(), but cannot figure out if it can be applied. If all else fails, I can find Matches using the MatchCollection and then switch out the 2007 value with 2008; however, I'm hoping for something more elegant MatchCollections matches = yearFind.Matches(" 2007 [2007 _2007"); foreach (Match match in matches){ //use match to find and replace value }

    Read the article

  • Define a regex, which matches one digit twice and all others once

    - by Amin
    As part of a larger regex I would like to match the following restrictions: The string has 11 digits All digits are numbers Within the first 10 digits one number [0-9] (and one only!) must be listed twice This means the following should match: 12345678914 12235879600 Whereas these should not: 12345678903 -> none of the numbers at digits 1 to 10 appears twice 14427823482 -> one number appears more than twice 72349121762 -> two numbers appear twice I have tried to use a lookahead, but all I'm managing is that the regex counts a certain digit, i.e.: (?!.*0\1{2}) That does not do what I need. Is my query even possible with regex?

    Read the article

  • xml regular expression/regex OR operator

    - by Naz Haque
    Hi am trying to use a regeX to read through my document to identify currency types whether they're $,£ or a €. The regex I've created doesn't seem to work, somebody please advise me what it should be. I'd really appreciate the help: The regEX I've created ("\$|£|€]")is in a simpleType within my XSD file used for validating a document. The code is show after the colon, please note to display on stackoverflow I've had to remove the open/close tags (<): xs:simpleType name="currencyType" xs:restriction base="utf8-string" xs:length value="1" / xs:pattern value="[\$|£|€]"/ /xs:restriction /xs:simpleType

    Read the article

  • Validate Canadian Postal Code Regex

    - by Alex Block
    I have a script written in JavaScript to Validate Canadian Postal Codes using Regex, however it does not seem to be working. Here is the script: If statement: if (myform.zip.value == "" || myform.zip.value == null || myform.zip.value == "Postal Code" || myform.zip.value.length < 12 ) { alert("Please fill in field Postal Code. You should only enter 7 characters"); myform.zip.focus(); return false; } Function: function okNumber(myform) { var regex = /^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$/; if (regex.test(myform.zip.value) == false) { alert("Input Valid Postal Code"); myform.zip.focus(); return false; } return true; }

    Read the article

  • Replacement Text Syntax for JavaScript’s String.replace()

    - by Jan Goyvaerts
    A RegexBuddy user told me that he couldn’t easily find a detailed explanation of the replacement text syntax supported by the String.replace() function in JavaScript. I had to admin that my own web page about JavaScript’s regular expression support was also lacking. I’ve now added a new Replacement Syntax section that has all the details. I’ll summarize it here: $1: Text matched by the first capturing group or the literal text $1 if the regex has no capturing groups. $99: Text matched by the 99th capturing group if the regex has 99 or more groups. Text matched by the 9th capturing group followed by a literal 9 if the regex has 9 or more but less than 99 groups. The literal text $99 if the regex has fewer than 9 groups. $+: Text matched by the highest-numbered capturing group. Replaced with nothing if the highest-numbered group didn’t participate in the match. $&: Text matched by the entire regex. You cannot use $0 for this. $` (backtick): Text to the left of the regex match. $' (single quote): Text to the right of the regex match. $_: The entire subject string.

    Read the article

  • linker error when using tr1::regex

    - by Max
    Hello. I've got a program that uses tr1::regex, and while it compiles, it gives me very verbose linker errors. Here's my header file MapObject.hpp: #include <iostream> #include <string> #include <tr1/regex> #include "phBaseObject.hpp" using std::string; namespace phObject { class MapObject: public phBaseObject { private: string color; // must be a hex string represented as "#XXXXXX" static const std::tr1::regex colorRX; // enforces the rule above public: void setColor(const string&); (...) }; } Here's my implementation: #include <iostream> #include <string> #include <tr1/regex> #include "MapObject.hpp" using namespace std; namespace phObject { const tr1::regex MapObject::colorRX("#[a-fA-F0-9]{6}"); void MapObject::setColor(const string& c) { if(tr1::regex_match(c.begin(), c.end(), colorRX)) { color = c; } else cerr << "Invalid color assignment (" << c << ")" << endl; } (...) } and now for the errors: max@max-desktop:~/Desktop/Development/CppPartyHack/PartyHack/lib$ g++ -Wall -std=c++0x MapObject.cpp /tmp/cce5gojG.o: In function std::tr1::basic_regex<char, std::tr1::regex_traits<char> >::basic_regex(char const*, unsigned int)': MapObject.cpp:(.text._ZNSt3tr111basic_regexIcNS_12regex_traitsIcEEEC1EPKcj[std::tr1::basic_regex<char, std::tr1::regex_traits<char> >::basic_regex(char const*, unsigned int)]+0x61): undefined reference tostd::tr1::basic_regex ::_M_compile()' /tmp/cce5gojG.o: In function bool std::tr1::regex_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char, std::tr1::regex_traits<char> >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::tr1::basic_regex<char, std::tr1::regex_traits<char> > const&, std::bitset<11u>)': MapObject.cpp:(.text._ZNSt3tr111regex_matchIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcEEEEbT_S8_RKNS_11basic_regexIT0_T1_EESt6bitsetILj11EE[bool std::tr1::regex_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char, std::tr1::regex_traits<char> >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::tr1::basic_regex<char, std::tr1::regex_traits<char> > const&, std::bitset<11u>)]+0x53): undefined reference tobool std::tr1::regex_match<__gnu_cxx::__normal_iterator, std::allocator , std::allocator, std::allocator , char, std::tr1::regex_traits (__gnu_cxx::__normal_iterator, std::allocator , __gnu_cxx::__normal_iterator, std::allocator , std::tr1::match_results<__gnu_cxx::__normal_iterator, std::allocator , std::allocator, std::allocator &, std::tr1::basic_regex const&, std::bitset<11u)' collect2: ld returned 1 exit status I can't really make heads or tails of this, except for the undefined reference to std::tr1::basic_regex near the beginning. Anyone know what's going on?

    Read the article

  • Help with regex to detect urls in a string

    - by Ali Taha Ali Mahboub
    Hi guys i found this regex to detect urls in a string and wraps them inside the tag public static String detectUrls(String text) { String newText = text .replaceAll("(?<!http://)www\\.[\\w/%.\\-?&=]+", "http://$0") .replaceAll("(?:https?|ftps?|http?)://[\\w/%.\\-?&=]+", "<a href='$0'>$0</a>"); return newText; } but this regex doesn't work with the following pattern: https://www.myserver.com so please advise.

    Read the article

  • Regex to match partial words (JavaScript)

    - by nw
    I would like to craft a case-insensitive regex (for JavaScript) that matches street names, even if each word has been abbreviated. For example: n univ av should match N University Ave king blv should match Martin Luther King Jr. Blvd ne 9th should match both NE 9th St and 9th St NE Bonus points (JK) for a "replace" regex that wraps the matched text with <b> tags.

    Read the article

  • Trying to learn regex

    - by Gandalf StormCrow
    Hello everyone I'm trying to learn regex from java website and I try to run this JAVA program but each time I get No Console output, what do I do ? here is the url : http://java.sun.com/docs/books/tutorial/essential/regex/test_harness.html

    Read the article

  • Can PCRE regex match a null character?

    - by Keng
    I have a text source with nulls in it and I need to pull them out along with my regex pattern. Can regex even match a null character? I only realized I had them when my pattern refused to match and when I pasted it into Notepad++ it showed all the null characters.

    Read the article

  • Java - Regex problem

    - by Yatendra Goel
    I want to remove ) character from the end of a string through a regex. E.g If a string is UK(Great Britain) then I want to replace the last ) symbol. Note: 1). The regex should remove only the last ) symbol, doesn't matter how many ) symbols are present in the string.

    Read the article

  • Python regex group clarification

    - by nkr1pt
    I have 0 experience with python, very little with regex and I'm trying to figure out what this small snippet of python regex would give back from a http response header Set-Cookie entry: REGEX_COOKIE = '([A-Z]+=[^;]+;)' resp = urllib2.urlopen(req) re.search(REGEX_COOKIE, resp.info()['Set-Cookie']).group(1) Can one give a simple example of a Set-Cookie value and explain what this would match on + return? Regards

    Read the article

  • Regex split into overlapping strings

    - by polygenelubricants
    I'm exploring the power of regular expressions, so I'm just wondering if something like this is possible: public class StringSplit { public static void main(String args[]) { System.out.println( java.util.Arrays.deepToString( "12345".split(INSERT_REGEX_HERE) ) ); // prints "[12, 23, 34, 45]" } } If possible, then simply provide the regex (and preemptively some explanation on how it works). If it's only possible in some regex flavors other than Java, then feel free to provide those as well. If it's not possible, then please explain why.

    Read the article

  • regex to parse a iCalendar file in ActionScript

    - by Mac Fly
    Hello, I use a library to parse an iCalendar file, but I don't understand the regex to split property. iCalendar property has 3 different style: BEGIN:VEVENT DTSTART;VALUE=DATE:20080402 RRULE:FREQ=YEARLY;WKST=MO The library uses this regex that I would like to understand: var matches:Array = data.match(/(.+?)(;(.*?)=(.*?)((,(.*?)=(.*?))*?))?:(.*)$/); p.name = matches[1]; p.value = matches[9]; p.paramString = matches[2]; Thanks.

    Read the article

  • Regex Not Matching Unicode

    - by cam
    How would I go about using Regex to match Unicode strings? I'm loading in a couple keywords from a text file and using them with Regex on another file. The keywords both contain unicode (such á, etc). I'm not sure where the problem is. Is there some option I have to set?

    Read the article

  • How to use regex to extract nested patterns

    - by Rob Romanek
    Hi I'm struggling with some regex I've got a string like this: a:b||c:{d:e||f:g}||h:i basically name value pairings. I want to be able to parse out the pairings so I get: a:b c:{d:e||f:g} h:i then I can further parse the pairings contained in { } if required It is the nesting that is making me scratch my head. Any regex experts out there that can give me a hand? thanks, Rob

    Read the article

  • Help me out in writing REGEX

    - by giri
    Hi I like to know how to write REGEX for the following code. <a href="/search?q=user:111111+[apple]" class="post-tag" title="show all posts by this user in 'apple'">Apple</a><span class="item-multiplier">&times;&nbsp;171</span><br> I just need to fetch Apple from the above source code. Can anybody help me out in writing REGEX. Thanks

    Read the article

  • asp.net regex help

    - by dominic
    Hi ive got this regular expression and that extracts numbers from a string string.Join(null,System.Text.RegularExpressions.Regex.Split(expr, "[^\\d]")); so eg, the format of my string is like this strA:12, strB:14, strC:15 so the regex returns 121415 how can I modify the expression to return 12,14,15 instead, any suggestions please

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >