Search Results

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

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

  • which regular expression will capture this sequence?

    - by John Smith
    The text follows this pattern <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) so basically the above line might repeat itself multiple times, and the idea is to retrieve the first 3 characters immediately after ABC. I have tried regular expressions along the lines of \<tr class="text" [.]+ABC(?<capture>[.]{3}) but they all fail. Can someone give me a hint?

    Read the article

  • Help me to split string with Regular Expression

    - by Lu Lu
    Hello, I have a string: CriteriaCondition={FieldName={*EPS}*$MinValue=(-201)$MaxValue=(304)$TradingPeriod=(-1)} Help me to get the first word which ends with the first word "={" & get the next following word which ends with "}". The result must be: Word1 = "CriteriaCondition" Word2 = "FieldName={EPS}$MinValue=(-201)$MaxValue=(304)$TradingPeriod=(-1)" And with the string "FieldName=(EPS)$MinValue=(-201)$MaxValue=(304)$TradingPeriod=(-1)", help me to split to pairs: FieldName EPS MinValue -201 MaxValue 304 TradingPeriod -1 Thanks.

    Read the article

  • Extract a regular expression match in R version 2.10

    - by tovare
    Hi, I'm trying to extract a number from a string. And do something like this [0-9]+ on this string "aaaa12xxxx" and get "12". I thought it would be something like: > grep("[0-9]+","aaa12xxx", value=TRUE) [1] "aaa12xxx" And then I figured... > sub("[0-9]+", "\\1", "aaa12xxxx") [1] "aaa12xxx" But I got some form of response doing: > sub("[0-9]+", "ARGH!", "aaa12xxxx") [1] "aaaARGH!xxx" There's a small detail I'm missing Please advice :-) I'm using R version 2.10.1 (2009-12-14) Thanks ! Comments on the solution The best solution is to ignore the standard functions and install Hadley Wickham's stringr package to get something that actually makes sense. Kudos to Marek for figuring out how the standard library worked.

    Read the article

  • Pass a captured named regular expression to URL dictionary in generic view

    - by Trent Jurewicz
    I am working with a generic view in Django. I want to capture a named group parameter in the URL and pass the value to the URL pattern dictionary. For example, in the URLConf below, I want to capture the parent_slug value in the URL and pass it to the queryset dictionary value like so: urlpatterns = patterns('django.views.generic.list_detail', (r'^(?P<parent_slugs>[-\w])$', 'object_list', {'queryset':Promotion.objects.filter(category=parent_slug)}, 'promo_promotion_list'), ) Is this possible to do in one URLConf entry, or would it be wiser if I create a custom view to capture the value and pass the queryset directly to the generic view from my overridden view?

    Read the article

  • Regular Expression - Match only 7 chars?

    - by Simon
    I'm trying to match a SEDOL (exactly 7 chars: 6 alpha-numeric chars followed by 1 numeric char) My regex ([A-Z 0-9]{6})[0-9]{1} matches correctly but strings greater than 7 chars that begin with a valid match also match (if you see what I mean :)). For example: B3KMJP4 matches correctly but so does: B3KMJP4x which shouldn't match. Can anyone show me how to avoid this?

    Read the article

  • Scala: Matching optional Regular Expression groups

    - by Brian Heylin
    I'm trying to match on an option group in Scala 2.8 (beta 1) with the following code: import scala.xml._ val StatementPattern = """([\w\.]+)\s*:\s*([+-])?(\d+)""".r def buildProperty(input: String): Node = input match { case StatementPattern(name, value) => <propertyWithoutSign /> case StatementPattern(name, sign, value) => <propertyWithSign /> } val withSign = "property.name: +10" val withoutSign = "property.name: 10" buildProperty(withSign) // <propertyWithSign></propertyWithSign> buildProperty(withoutSign) // <propertyWithSign></propertyWithSign> But this is not working. What is the correct way to match optional regex groups?

    Read the article

  • Find last match with python regular expression

    - by SDD
    I wanto to match the last occurence of a simple pattern in a string, e.g. list = re.findall(r"\w+ AAAA \w+", "foo bar AAAA foo2 AAAA bar2) print "last match: ", list[len(list)-1] however, if the string is very long, a huge list of matches is generated. Is there a more direct way to match the second occurence of "AAAA" or should I use this workaround?

    Read the article

  • Buggy Perl regular expression

    - by Tichomir Mitkov
    Hi, there I'm writing a program that has to get values from a file. In the file each line indicates an entity. Each entity has three values. For example: Value1 Value2 value3 I have a regular expresion to match them m/(.*?) (.*?) (.*?)/m; But it seems that the third value in never matched! The only way to match the third value is to add another value in the file and another "matching brackets" in the expresion. But this does not satisfy me. Thanks in Advance!

    Read the article

  • regular expression for letters, numbers and - _ .

    - by Jorre
    I'm having trouble checking in PHP if a value is is any of the following combinations letters (upper or lowercase) numbers (0-9) underscore (_) dash (-) point (.) no spaces! or other characters a few examples: OK: "screen123.css" OK: "screen-new-file.css" OK: "screen_new.js" NOT OK: "screen new file.css" I guess I need a regex for this, since I need to throw an error when a give string has other characters in it than the ones mentioned above.

    Read the article

  • how to fix my error saying expected expression before 'else'

    - by user292489
    this program intended to read a .txt, a set of numbers, file and wwrite to another two .txt files called even amd odd as follows: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i=0,even,odd; int number[i]; // check to make sure that all the file names are entered if (argc != 3) { printf("Usage: executable in_file output_file\n"); exit(0); } FILE *dog = fopen(argv[1], "r"); FILE *feven= fopen(argv[2], "w"); FILE *fodd= fopen (argv[3], "w"); // check whether the file has been opened successfully if (dog == NULL) { printf("File %s cannot open!\n", argv[1]); exit(0); } //odd = fopen(argv[2], "w"); { if (i%2!=1) i++;} fprintf(feven, "%d", even); fscanf(dog, "%d", &number[i]); else { i%2==1; i++;} fprintf(fodd, "%d", odd); fscanf(dog, "%d", &number[i]); fclose(feven); fclose(fodd);

    Read the article

  • xpath help substring expression

    - by NA
    Hi i have a document from which i am trying to extract a date. But the problem is within the node along with the date their is some text too. Something like <div class="postHeader"> Posted on July 20, 2009 9:22 PM PDT </div> From this tag i just want the date item not the Posted on text. something like ./xhtml:div[@class = 'postHeader'] is getting everything. and to be precise, the document i have is basically a nodelist of this elements for eg i will get 10 nodes of these elements with different date values but to be worse the problem is sometime inside these tags some random other tags also pops us like anchors etc. Can i write a universal expath which will just get the date out of the div tag?

    Read the article

  • [Python] OR in regular expression?

    - by www.yegorov-p.ru
    Hello. I have text file with several thousands lines. I want to parse this file into database and decided to write a regexp. Here's part of file: blablabla checked=12 unchecked=1 blablabla unchecked=13 blablabla checked=14 As a result, I would like to get something like (12,1) (0,13) (14,0) Is it possible?

    Read the article

  • regular expression for emails NOT ending with replace script

    - by corroded
    I'm currently modifying my regex for this: http://stackoverflow.com/questions/2782031/extracting-email-addresses-in-an-html-block-in-ruby-rails basically, im making another obfuscator that uses ROT13 by parsing a block of text for all links that contain a mailto referrer(using hpricot). One use case this doesn't catch is that if the user just typed in an email address(without turning it into a link via tinymce) So here's the basic flow of my method: 1. parse a block of text for all tags with href="mailto:..." 2. replace each tag with a javascript function that changes this into ROT13 (using this script: http://unixmonkey.net/?p=20) 3. once all links are obfuscated, pass the resulting block of text into another function that parses for all emails(this one has an email regex that reverses the email address and then adds a span to that email - to reverse it back) step 3 is supposed to clean the block of text for remaining emails that AREN'T in a href tags(meaning it wasn't parsed by hpricot). Problem with this is that the emails that were converted to ROT13 are still found by my regex. What i want to catch are just emails that WEREN'T CONVERTED to ROT13. How do i do this? well all emails the WERE CONVERTED have a trailing "'.replace" in them. meaning, i need to get all emails WITHOUT that string. so far i have this regex: /\b([A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}('.replace))\b/i but this gets all the emails with the trailing '.replace i want to get the opposite and I'm currently stumped with this. any help from regex gurus out there? MORE INFO: Here's the regex + the block of text im parsing: http://www.rubular.com/r/NqXIHrNqjI as you can see, the first two 'email addresses' are already obfuscated using ROT13. I need a regex that gets the emails [email protected] and [email protected]

    Read the article

  • Grep expression with special file names

    - by user2919185
    i am a real beginner in csh/tcsh scripting and that's why i need your help. The problem is I have to go through some regular files in directories and find those files, that have their own name in its content. In the following piece of script is cycle in which I am going through paths and using grep to find the file's name in its content. What is surely correct is $something:q - is array of paths where i have to find files. The next variable is name in which is only name of current file. for example: /home/computer/text.txt (paths) and: text.txt (name) And my biggest problem is to find names of files in their content. It's quite difficult for me to write correct grep for this, cause the names of files and directories that i am passing through are mad. Here are some of them: /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/!_1 /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/dam/$user/:e/'/-r /home/OS/pocitacove/testovaci_adresar/z/test3/skusime/ taketo/ taketo /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/.-bla/.-bla/.a=b /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/.-bla/.-bla/@ /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/.-bla/.-bla/: /home/OS/pocitacove/testovaci_adresar/z/test4.pre_expertov/.-bla/.-bla/'ano' foreach paths ($something:q) set name = "$paths:t" @ number = (`grep -Ec "$name" "$paths"`) if ($number != 0) then echo -n "$paths " echo $number endif @ number = 0 end

    Read the article

  • How to let an average user design a boolean expression graphically

    - by Svein Bringsli
    In our application there's a list of customers, and a list of keywords (among other things). Each customer can have a number of keywords, but it's not mandatory. So for instance, one customer can have the keywords "retail" and "chain", one can have only "contractor" and a third can have none at all. I want to let the user make a selection of customers based on these keywords, but not having to write (retail AND chain) or contractor and not wholesale I would like to make it as user-friendly as possible, and ideally with only "simple" controls, like checkboxes, comboboxes etc. Does anyone have any suggestions on how to design this? Or maybe some examples of applications where there are similar functionality?

    Read the article

  • Regular expression and newline

    - by Ockonal
    Hello guys, I have such text: <[email protected]> If you do so, please include this problem report. <[email protected]> You can delete your own text from the attached returned message. The mail system <[email protected]>: connect to *.net[82.*.86.*]: Connection timed out I have to parse email from it. Could you help me with this job? upd There could be another email addresses in <%here%. There should be connection between 'The mail system' text. I need in email which goes after that text.

    Read the article

  • regular expression and escaping

    - by pstanton
    Sorry if this has been asked, my search brought up many off topic posts. I'm trying to convert wildcards from a user defined search string (wildcard is "*") to postgresql like wildcard "%". I'd like to handle escaping so that "%" => "\%" and "\*" => "*" I know i could replace \* with something else prior to replacing * and then swap it back, but i'd prefer not to and instead only convert * using a pattern that selects it when not proceeded by \. String convertWildcard(String like) { like = like.replaceAll("%", "\\%"); like = like.replaceAll("\\*", "%"); return like; } Assert.assertEquals("%", convertWildcard("*")); Assert.assertEquals("\%", convertWildcard("%")); Assert.assertEquals("*", convertWildcard("\*")); // FAIL Assert.assertEquals("a%b", convertWildcard("a*b")); Assert.assertEquals("a\%b", convertWildcard("a%b")); Assert.assertEquals("a*b", convertWildcard("a\*b")); // FAIL ideas welcome.

    Read the article

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