Search Results

Search found 3804 results on 153 pages for 'regex'.

Page 33/153 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • mysql - speedup regex

    - by Uwe
    I have a table: +--------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+------------------+------+-----+---------+----------------+ | idurl | int(11) | NO | PRI | NULL | auto_increment | | idsite | int(10) unsigned | NO | MUL | NULL | | | url | varchar(2048) | NO | | NULL | | +--------+------------------+------+-----+---------+----------------+ the select statement is: SELECT idurl, url FROM URL WHERE idsite = 34 AND url REGEXP '^https\\://www\\.domain\\.com/checkout/step_one\\.php.*' The query needs 5 seconds on a table with 1000000 rows. Can I achieve a speedup with indexes or something else?

    Read the article

  • PHP regex help with preg_match_all

    - by Steve
    Hi, I am trying to refine a preg_match_all by finding the second occurrence of a period then a space: <?php $str = "East Winds 20 knots. Gusts to 25 knots. Waters a moderate chop. Slight chance of showers."; preg_match_all ('/(^)((.|\n)+?)(\.\s{2})/',$str, $matches); $dataarray=$matches[2]; foreach ($dataarray as $value) { echo $value; } ?> But it does not work: the {2} occurrence is incorrect. I have to use preg_match_all because I a scraping dynamic HTML. I want to capture this from the string: East Winds 20 knots. Gusts to 25 knots. Any ideas? Thx

    Read the article

  • Match HTML tags in two strings using regex in Python

    - by jack
    I want to verify that the HTML tags present in a source string are also present in a target string. For example: >> source = '<em>Hello</em><label>What's your name</label>' >> verify_target(’<em>Hi</em><label>My name is Jim</label>') True >> verify_target('<label>My name is Jim</label><em>Hi</em>') True >> verify_target('<em>Hi<label>My name is Jim</label></em>') False

    Read the article

  • Extract parts of html using regex

    - by Fred Yang
    I have a simple requirement to extract text in html. Suppose the html is <h1>hello</h1> ... <img moduleType="calendar" /> ...<h2>bye</h2> I want to convert it into three parts <h1>hello</h1> <img moduleType="calendar" /> <h2>bye</h2> The aim is to extract text in two categories, simple html and special tags with <img moduleType="Calender".

    Read the article

  • python regex of a date in some text

    - by Horace Ho
    How can I find as many date patterns as possible from a text file by python? The date pattern is defined as: dd mmm yyyy ^ ^ | | +---+--- spaces where: dd is a two digit number mmm is three-character English month name (e.g. Jan, Mar, Dec) yyyy is four digit year there are two spaces as separators Thanks!

    Read the article

  • regex to escape non-html tags' angle brackets

    - by suad
    Hi I have an html based text (with html tags), I want to find words that occur within angle brackets and replace the brackets with < and > or even when angle brackets are used as math symobls e.g: String text= "Hello, <b> Whatever <br/> <table> <tr> <td width="300px"> 1<2 This is a <test> </td> </tr> </table>"; I want this to be : Hello, <b> Whatever <br/> <table> <tr> <td width="300px"> 1&lt;2 This is a &lt;test&gt; </td> </tr> </table> THANKS in advance

    Read the article

  • How do I create regex groups for replacement?

    - by resting
    I have this sample string: Image: SGD$45.32 SKU: 3f3f3 dfdfd grg4t BP 6yhf Pack Size: 1000's Color: Green Price: SGD$45.32 SGD$45... I would like to remove all the prices namely: SGD$45.32 Price: SGD$45.32 SGD$45 I have this expression thats supposed to match the 3 groups: $pattern = '/(Price.+\sSGD\$\d+\.\d{2})(SGD\$\d+\.\d{2})(SGD\$\d+)/'; $new_snippet = preg_replace($pattern, '', $snippet);` But apparently its not working. It works if I replace a single group at a time. But, I'd like to know if it possible to replace all possible matching groups with a single statement. Tried preg_match_all($pattern, $snippet, $matches); to show matches based on the above pattern, but no matches are found if I put all 3 groups together.

    Read the article

  • Regex with dynamic <textarea>

    - by Oscar Godson
    How can I do this with the JS replace() method: Make \n\n change to <p>$1</p> Change single \n to <br> Then back again. I think I have this part, see the JS at the bottom. Example HTML: <p>Hello</p><p>Wor<br>ld</p> The <textarea> would look like: Hello Wor ld So, how can I achieve this? It's an AJAX form where when you click on this div it changes to a <textarea> and back, and fourth, etc. So, I need to it to go from <p>s and <br>s to \n\n and \n. For the going to <textarea> from HTML I have: $(this).html().replace(/\s?<\/?(p|br\s?\/?)>\s?/g,"\n")

    Read the article

  • Java regex basic usage problem

    - by Ernelli
    The following code works: String str= "test with foo hoo"; Pattern pattern = Pattern.compile("foo"); Matcher matcher = pattern.matcher(str); if(matcher.find()) { ... } But this example does not: if(Pattern.matches("foo", str)) { ... } And neither this version: if(str.matches("foo")) { ... } In the real code, str is a chunk of text with multiple lines if that is treated differently by the matcher, also in the real code, replace will be used to replace a string of text. Anyway, it is strange that it works in the first version but not the other two versions.

    Read the article

  • Javascript REGEX

    - by Fernando SBS
    <th>Prêmio</th> <td colspan="11"> <div class="res"><img class="r1" src="img/x.gif" alt="Madeira" title="Madeira" />215 | <img class="r2" src="img/x.gif" alt="Barro" title="Barro" />193 | <img class="r3" src="img/x.gif" alt="Ferro" title="Ferro" />192 | <img class="r4" src="img/x.gif" alt="Cereal" title="Cereal" />202</div><div class="carry"><img class="car" src="img/x.gif" alt="carregamento" title="carregamento" />802/1800</div></td></tr></tbody></table><table cellpadding="1" cellspacing="1" class="defender"> <thead> <tr> i'm trying to get "802/1800", but it's driving me insane. if I use: var myregexp = /title="carregamento"/; it works but going to the next step which is: var myregexp = /title="carregamento" \/>/ already returs me null.

    Read the article

  • regex jquery remove all double spaces

    - by michael
    Hi I have this code, I want it to remove all the double spaces from a text area, but it will only remove the first occurrence each time. $(document).ready(function(){ $("#article").blur(function(){ ///alert($(this).val()); $(this).val($(this).val().replace(/\s\s+/, ' ')); }); }); I've also tried removeAll(), but it won't work at all. any help would be great, thanks. I have a live example online at http://jsbin.com/ogasu/2/edit

    Read the article

  • Regex to Exclude Double spaces

    - by Ian
    Hi, I am looking for a regular expression for c# asp.net 3.5 that will fail if there are ever any double spaces in a sentence or group of words. the cat chased the dog = true the cat chased the dog = false (doubles spaces occur at random intervals) thanks

    Read the article

  • Regular expression quantifier questions

    - by Josemalive
    Hello, Im trying to find a regular expression that matches this kind of URL: http://sub.domain.com/selector/F/13/K/100546/sampletext/654654/K/sampletext_sampletext.html and dont match this: http://sub.domain.com/selector/F/13/K/10546/sampletext/5987/K/sample/K/101/sample_text.html only if the number of /K/ is minimum 1 and maximum 2 (something with a quantifier like {1,2}) Until this moment i have the following regexp: http://sub\.domain\.com/selector/F/[0-9]{1,2}/[a-z0-9_-]+/ Now i would need a hand to add any kind of condition like: Match this if in the text appears the /K/ from 1 to 2 times at most. Thanks in advance. Best Regards. Josema

    Read the article

  • Help with regex in javascript.

    - by Bipul
    Whatever string is given I have to see if there is exactly one space after and before =, If it is more than one space in either side I have to reduce that to one and if there is none, I have to insert one. How should I do that ? String can contain anything. Thanks

    Read the article

  • What does the following Regex expression do?

    - by Jim
    Hi, I would like to understand what the following code is doing. This logic is part of a routine to strip out html from the body of an email message. mBBSREgEx.IgnoreCase = True mBBSREgEx.Global = True mBBSREgEx.Pattern = "<[^>]*>" sResult = mBBSREgEx.Replace(sResult, "") Thank you, Jim

    Read the article

  • regex to match letters, numbers, certain symbols

    - by Hintswen
    I need to validate a username in php, it can be: Letters (upper and lower case) Numbers Any of these symbols :.,?!@ up to 15 characters OR 16 if the last character is one of the following #$^ (it can also be 15 or less with one of these 3 characters at the end only) How do I do this?

    Read the article

  • RegEx Advanced : Positive lookbehind

    - by mpneuried
    This is my test-string: <img rel="{objectid:498,newobject:1,fileid:338}" width="80" height="60" align="left" src="../../../../files/jpg1/Desert1.jpg" alt="" /> I want to get each of the JSON formed Elements inbetween the rel attribute. It's working for the first element (objectid). Here is my ReqEx, which works fine: (?<=(rel="\{objectid:))\d+(?=[,|\}]) But i want to do somthing like this, which doesn't work: (?<=(rel="\{.*objectid:))\d+(?=[,|\}]) So i can parse every element of the search string. I'm using Java-ReqEx

    Read the article

  • C# method contents regex validation

    - by user258651
    I need to validate the contents of a C# method. I do not care about syntax errors. I do care about characters that will invalidate parsing of the rest of the code. For example: method() { /* valid comment */ /* <-- bad for (i..) { } for (i..) { <-- bad } I need to validate/fix any non-paired characters. This includeds /* */, { }, and maybe others. How should I go about this?

    Read the article

  • Regex for recursive "wiki-style" lists

    - by Syd Miller
    I'm trying to create a Regular Expression to match "wiki style" lists as in (using preg_replace_callback() ): * List Item 1 * List Item 2 *# List Item 2.1 *# List Item 2.2 * List Item 3 Asterisks denote Unordered Lists while Number-Signs denote Ordered Lists. I'm trying to get this so it can match infinite depth and so that * and # can be mixed. I tried the following expression (and variations of it): /\s([*#]{1,}) ([\S ]+)\s/si But it doesn't seem to want to work. What am I doing wrong? Or is there a better way of accomplishing this?

    Read the article

  • Parsing XML file with perl - regex

    - by dusker
    Hi Everyone, i'm just a begginer in perl, and very urgently need to prepare a small script that takes top 3 things from an xml file and puts them in a new one. Here's an example of an xml file: <article> {lot of other stuff here} </article> <article> {lot of other stuff here} </article> <article> {lot of other stuff here} </article> <article> {lot of other stuff here} </article> What i'd like to do is to get first 3 items along with all the tags in between and put it into another file. Thanks for all the help in advance regards peter

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >