Search Results

Search found 530 results on 22 pages for 'regexp'.

Page 3/22 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • regexp exclusion

    - by Vlad
    Hello everyone! I have regexp to change smileys to images. Here it is (?:(?![0]:\)|:\)\)|:-\)\)))(:\)|:-\)) The point is not to change 0:) and :)) and :-)) while changing :) and :-) It works pretty well with :)) and :-)) but somehow still grabs :) in 0:) Where's my mistake?

    Read the article

  • Implement python replace() function without using regexp

    - by jwesonga
    I'm trying to rewrite the equivalent of the python replace() function without using regexp. Using this code, i've managed to get it to work with single chars, but not with more than one character: def Replacer(self, find_char, replace_char): s = [] for char in self.base_string: if char == find_char: char = replace_char #print char s.append(char) s = ''.join(s) my_string.Replacer('a','E') Anybody have any pointers how to make this work with more than one character? example: my_string.Replacer('kl', 'lll')

    Read the article

  • Emacs align-regexp on = but not ==

    - by Karl
    I am working in Haskell and frequently come across code similar to the following: func i j | i == j = i | otherwise = j I want to align on the '=' character using align-regexp but don't have the elisp knowhow. I have tried just doing " = " without the quotes, but this inserts an unwanted space character before each '='. I have found a proposed solution here but I can't seem to get that to do anything at all. Please help me write a function or hard-coded macro that will allow me to set a keybinding for this.

    Read the article

  • glibc regexp performance

    - by Jack
    Anyone has experience measuring glibc regexp functions? Are there any generic tests I need to run to make such a measurements (in addition to testing the exact patterns I intend to search)? Thanks.

    Read the article

  • extract variables from an expression using javascript regexp

    - by powerboy
    For example, here is a string representing an expression: var str = 'total = sum(price * qty) * 1.09875'; I want to extract variables (i.e., 'total', 'price' and 'qty' but not 'sum' since 'sum' is a function name) from this expression. What is the regexp pattern in javascript? Variable name consists of letters, digits, or the underscore, beginning with letters or the underscore.

    Read the article

  • Php and python regexp difference?

    - by Ajel
    I need to parse a string 'Open URN: 100000 LA: ' and get 100000 from it. on python regexp (?<=Open URN: )[0-9]+(?= LA:) works fine but in php it gives following error: preg_match(): Unknown modifier '[' I need it working php, so please help me to solve this problem and tell about difference in python and php regexps.

    Read the article

  • MySql Not Like Regexp?

    - by KnockKnockWhosThere
    I'm trying to find rows where the first character is not a digit. I have this: SELECT DISTINCT(action) FROM actions WHERE qkey = 140 AND action NOT REGEXP '^[:digit:]$'; But, I'm not sure how to make sure it checks just the first character...

    Read the article

  • Replacing multiple `-` with one `-` without regexp

    - by Adam Kiss
    I've seen so many misuses of RegExp, I don't really like it :) I have string (as a result of two str_replaces) that might look something like this: .?This iš my ".stRiNg."! | V --this-is-my---string--- Is there any way better than $string = trim(preg_replace('/[-]+/u','-', $string),'-'); to get: this-is-my-string ?

    Read the article

  • Matching part of website with a regexp.

    - by richardverbruggen
    With a cURL request I load a complete website into a variable: $buffer. In the source of the site there are two labels in between which my relevant content is placed. ****** bunch of code ******* <!-- InstanceBeginEditable name="Kopij" --> this part I want to store in a match <!-- InstanceEndEditable --> ****** bunch of code ******* I've been messing around with preg_match and its regexp. Can someone try to help me? Thanx in advance.

    Read the article

  • PHP Regexp problem...

    - by Crazy
    Hi! I want to replace this line : <img width="600" height="256" alt="javascript00" src="http://localhost/img/test.png" title="javascript00" class="aligncenter size-full wp-image-1973"> With this : <p align="center"><img width="600" height="256" alt="javascript00" src="http://localhost/img/test.png" title="javascript00"></p> By use a simple regexp. It consists to delete the image class and add a <p align="center"> around :) Thanks for help! And merry christmas :)

    Read the article

  • RegEXP Javascript URL matching

    - by Blondie
    I have this so far: chrome.tabs.getSelected(null, function(tab) { var title = tab.title; var btn = '<a href="' + tab.url + '" onclick="save(\'' + title + '\');"> ' + title + '</a>'; if(RegExp('/http:\/\/www.mydomain.com\/version.php/i') == true) { document.getElementById('link').innerHTML = '<p>' + btn + '</p>'; } }); Basically it should match the domain within this: http://www.mydomain.com/version.php?* Anything that matches that even when it includes something like version.php?ver=1, etc When I used the code above of mine, it doesn't display anything, but when I remove the if statement, it's fine but it shows on other pages which it shouldn't only on the matched URL.

    Read the article

  • case-insensitive regexp match on non-english text in perl cgi script

    - by jonny
    ok. I have list of catalog paths and need to filter out some of them. Match pattern comes in non-Unicode encoding. Tried following: require 5.004; use POSIX qw(locale_h); my $old_locale = setlocale(LC_ALL); setlocale(LC_ALL, "ru_RU.cp1251"); @{$data -> {doc_folder_rights}} = grep { $_->{doc_folder} =~/$_REQUEST{q}/i; # catalog path pattern in $_REQUEST{q} } @{$data -> {doc_folder_rights}}; setlocale(LC_ALL, $old_locale); What I need is case-insensitive regexp pattern matching when pattern contains russsian letters.

    Read the article

  • Invert regexp in vim

    - by Chris J
    There's a few "how do I invert a regexp" questions here on stackoverflow, but I can't find one for vim (if it does exist, by goggle-fu is lacking today). In essence I want to match all non-printable characters and delete them. I could write a short script, or drop to a shell and use tr or something similar to delete, but a vim solution would be dandy :-) Vim has the atom \p to match printable characters, however trying to do this :s/[^\p]//g to match the inverse failed and just left me with every 'p' in the file. I've seen the (?!xxx) sequence in other questions, and vim seems to not recognise this sequence. I've not found seen an atom for non-printable chars. In the interim, I'm going to drop to external tools, but if anyone's got any trick up their sleeve to do this, it'd be welcome :-) Ta!

    Read the article

  • preg_match , regexp , php , ignore white spaces and new lines

    - by Michael
    I'm trying to extract richard123 using php preg_replace but there are a lot of white spaces and new lines and I think because of that my regexp doesn't work . The html can be seen here : http://pastebin.com/embed_iframe.php?i=vuD3z9ij My current preg_match is : $find = "/< tr bgcolor=\"F0F0F0\" valign=\"middle\">< td align=\"left\">< font size=\"-1\">(.*)<\/font><\/td>/"; preg_match_all($find, $res, $matches2); print_r($matches2); I also tried <\/td/s"; <\/td/m"; <\/td/x"; but doesn't work either .

    Read the article

  • /regexp?/ on HTML, but not in form

    - by takeshin
    I need to do some regex replacement on HTML input, but I need to exclude some parts from filtering by other regexp. (e.g. remove all <a> tags with specific href="example.com…, except the ones that are inside the <form> tag) Is there any smart regex technique for this? Or do I have to find all forms using $regex1, then split the input to the smaller chunks, excluding the matched text blocks, and then run the $regex2 on all the chunks?

    Read the article

  • Confusion in RegExp Reluctant quantifier? Java

    - by Dusk
    Hi, Could anyone please tell me the reason of getting an output as: ab for the following RegExp code using Relcutant quantifier? Pattern p = Pattern.compile("abc*?"); Matcher m = p.matcher("abcfoo"); while(m.find()) System.out.println(m.group()); // ab and getting empty indices for the following code? Pattern p = Pattern.compile(".*?"); Matcher m = p.matcher("abcfoo"); while(m.find()) System.out.println(m.group());

    Read the article

  • Regexp in iOS to find comments

    - by SteveDolphin23
    I am trying to find and process 'java-style' comments within a string in objective-C. I have a few regex snippets which almost work but I am stuck on one hurdle: different options seem to make the different styles work. For example, I am using this to match: NSArray* matches = [[NSRegularExpression regularExpressionWithPattern:expression options:NSRegularExpressionAnchorsMatchLines error:nil] matchesInString:string options:0 range:searchRange]; The options here allow me successfully find and process single line comments (//) but not multiline (/* */), if I change the option to NSRegularExpressionDotMatchesLineSeparators then I can make multiline work fine but I can't find the 'end' of a single line comment. I suppose really I need dot-matches-line-separators but I need a better way of finding the end of a single line comment? The regexp I have so far are: @"/\\*.*?\\*/" @"//.*$" it's clear to see if dot matches a line separator then the second one (single line) never 'finishes' but how do I fix this? I found some suggestions for single line that were more like: @"(\/\/[^"\n\r]*(?:"[^"\n\r]*"[^"\n\r]*)*[\r\n])" But that doesn't' seem to work at all! Thanks in advance for any pointers.

    Read the article

  • Splitting Nucleotide Sequences in JS with Regexp

    - by TEmerson
    I'm trying to split up a nucleotide sequence into amino acid strings using a regular expression. I have to start a new string at each occurrence of the string "ATG", but I don't want to actually stop the first match at the "ATG". Valid input is any ordering of a string of As, Cs, Gs, and Ts. For example, given the input string: ATGAACATAGGACATGAGGAGTCA I should get two strings: ATGAACATAGGACATGAGGAGTCA (the whole thing) and ATGAGGAGTCA (the first match of "ATG" onward). A string that contains "ATG" n times should result in n results. I thought the expression /(?:[ACGT]*)(ATG)[ACGT]*/g would work, but it doesn't. If this can't be done with a regexp it's easy enough to just write out the code for, but I always prefer an elegant solution if one is available.

    Read the article

  • password validator using RegExp in Flex

    - by kalyaniRavi
    I have seen several examples in Flex for passowrd validator using RegExp. But every where the validation is happend for single validation. I have a requirement, like password validations like • At least one Upper case letter • At least one numeric character • At least one special character such as @, #, $, etc. • At least one Lower case letter • password lenght minimum 6 digits • password cannot be same as user name Can anyone provide me a code for this..? I have the code only for checking the password is valid or not . check the below code. MXML CODE <mx:FormItem label="Username:" x="83" y="96" width="66"> </mx:FormItem> <mx:FormItem label="Password:" x="88" y="123" width="61"> </mx:FormItem> <mx:Button label="Login" id="btnLogin" tabIndex="2" click="login();" enabled="{formIsValid}" x="327" y="162" width="84"/> <mx:TextInput id="txtPassword" displayAsPassword="true" change="validateForm(event);" x="152" y="121" width="217"/> <mx:TextInput id="txtUserId" change="validateForm(event);" x="152" y="94" width="217"/> AS Code: private function validateForm(event:Event):void { focussedFormControl = event.target as DisplayObject; formIsValid = true; formIsEmpty = (txtUserId.text == "" && txtPassword.text == ""); validate(strVUserId); validate(strVPassword); } private function validate(validator:Validator):Boolean { var validatorSource:DisplayObject = validator.source as DisplayObject; var suppressEvents:Boolean = (validatorSource != focussedFormControl); var event:ValidationResultEvent = validator.validate(null, suppressEvents); var currentControlIsValid:Boolean = (event.type == ValidationResultEvent.VALID); formIsValid = formIsValid && currentControlIsValid; return currentControlIsValid; }

    Read the article

  • regexp target last main li in list

    - by veilig
    I need to target the starting tag of the last top level LI in a list that may or may-not contain sublists in various positions - without using CSS or Javascript. Is there a simple/elegant regexp that can help with this? I'm no guru w/ them, but it appears the need for greedy/non-greedy selectors when I'm selecting all the middle text (.*) / (.+) changes as nested lists are added and moved around in the list - and this is throwing me off. $pattern = '/^(<ul>.*)<li>(.+<\/li><\/ul>)$/'; $replacement = '$1<li id="lastLi">$3'; Perhaps there is an easier approach?? converting to XML to target the LI and then convert back? ie: Single Element <ul> <li>TARGET</li> </ul> Multiple Elements <ul> <li>foo</li> <li>TARGET</li> </ul> Nested Lists before end <ul> <li> foo <ul> <li>bar</li> </ul> <li> <li>TARGET</li> </ul> Nested List at end <ul> <li>foo</li> <li> TARGET <ul> <li>bar</li> </ul> </li> </ul>

    Read the article

  • Flex: replace all spaces with comma

    - by Treby
    im new with regexp, so can i ask for some assistance Using string.replace function what code that can replace spaces with comma Input:The quick brown fox jumps over the lazy dog. Output:The,quick,brown,fox,jumps,over,the,lazy dog. Thanks

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >