Search Results

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

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

  • 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

  • regular expression code

    - by Gaia Andreoletti
    Deal all, I need to find match between two tab delimited files files like this: File 1: ID1 1 65383896 65383896 G C PCNXL3 ID1 2 56788990 55678900 T A ACT1 ID1 1 56788990 55678900 T A PRO55 File 2 ID2 34 65383896 65383896 G C MET5 ID2 2 56788990 55678900 T A ACT1 ID2 2 56788990 55678900 T A HLA what I would like to do is to retrive the matching line between the two file. What I would like to match is everyting after the gene ID So far I have written this code but unfortunately perl keeps giving me the error: use of "Use of uninitialized value in pattern match (m//)" Could you please help me figure out where i am doing it wrong? Thank you in advance! use strict; open (INA, $ARGV[0]) || die "cannot to open gene file"; open (INB, $ARGV[1]) || die "cannot to open coding_annotated.var files"; my @sample1 = <INA>; my @sample2 = <INB>; foreach my $line (@sample1) { my @tab = split (/\t/, $line); my $chr = $tab[1]; my $start = $tab[2]; my $end = $tab[3]; my $ref = $tab[4]; my $alt = $tab[5]; my $name = $tab[6]; foreach my $item (@sample2){ my @fields = split (/\t/,$item); if ($fields[1]=~ m/$chr(.*)/ && $fields[2]=~ m/$start(.*)/ && $fields[4]=~ m/$ref(.*)/ && $fields[5]=~ m/$alt(.*)/&& $fields[6]=~ m/$name(.*)/){ print $line,"\n",$item; } } }

    Read the article

  • Using regular expression to trim html

    - by Tim
    Been trying to solve this for a while now. I need a regex to strip the newlines, tabs and spaces between the html tags demonstrated in the example below: Source: <html> <head> <title> Some title </title> </head> </html> Wanted result: <html><head><title>Some title</title></head></html> The trimming of the whitespaces before the "Some title" is optional. I'd be grateful for any help

    Read the article

  • jQuery child selector expression

    - by Saiful
    <div id="div"> <div> <!-- first level --> <div> <!-- second level --> <div>1.1</div> <!-- third level --> <div>1.2</div> </div> <div> <div></div> <div>2.2</div> </div> </div> </div> What are the jQuery selector expressions for selecting the followings: 1. div commented by first level 2. divs commented by second level 3. divs commented by third level

    Read the article

  • Datable.Select sort expression

    - by xyz
    Hi, I have datatable with column name tag and 100 rows of data.I need to filter this table with tag starting with "UNKNOWN". What should my sortexpression for datatable.select be ? I'm trying the following. Datarow[] abc = null; abc = dtTagList.Select(string.format("tag='{0}'","UNKNOWN")) How can I achieve tag startswith 'UNKNOWN' in the above code ?

    Read the article

  • simplify expression k/m%n

    - by aaa
    hello. Simple question, is it possible to simplify (or replace division or modulo by less-expensive operation) (k/m)%n where variables are integers and operators are C style division and modulo operators. what about the case where m and n are constants (both or just one), not based 2? Thank you

    Read the article

  • Regular expression to Match addresses

    - by Burfi
    I have below set of strings to be searched : 1Dept Neurosci, The Univ. of New Mexico, ALBUQUERQUE, NM; 2Mol. and Human Genet., Baylor Col. of Med., Houston,, TX; 3Psychiatry, Univ. of Texas Southwestern Med. Ctr., Dallas, TX; 4Clin. Genet., Erasmus Univ. Med. Ctr., Rotterdam, Netherlands; 5Human Genet., Emory Univ., Atlanta, GA Above is a set of addresses , which starts with a digit (used to link it to the person).Need to search all the address as : 1Dept Neurosci, The Univ. of New Mexico, ALBUQUERQUE, NM 2Mol. and Human Genet., Baylor Col. of Med., Houston,, TX 3Psychiatry, Univ. of Texas Southwestern Med. Ctr., Dallas, TX 4Clin. Genet., ErasmusUniv. Med. Ctr., Rotterdam, Netherlands 5Human Genet., Emory Univ.Atlanta, GA I have written the below Regex : \d\w+,* It only matches a digit followed by a word . How can I modify it .Please suggest is there any better way.

    Read the article

  • dynamic xpath expression

    - by Ferol
    Good day, colleagues! Tell me please, how to make a dynamic xpath-parsing: for example, instead of writing $domXPath-query('//[(@id = "article-id-18")]'); - write something like that $domXPath-query('//[(@id = "article-id-*")]');, because in my case, the site's script generate (every time) a new id for block, that contains article's text? So question, is above.

    Read the article

  • Regular Expression to Match YouTube Watch URL

    - by dododedodonl
    Hi, I've got this regex (I'm not good at it) /http://www.youtube.com/watch?v=[a-zA-Z0-9_]/i it has to match any youtube watch url (because youtube always redirects to that domain)... It should match http://www.youtube.com/watch?v=iMXCqgWjpL8 but it doesn't. Can someone help me? Regard, dodo

    Read the article

  • Regular expression: who's greedier?

    - by polygenelubricants
    My primary concern is with the Java flavor, but I'd also appreciate information regarding others. Let's say you have a subpattern like this: (.*)(.*) Not very useful as is, but let's say these two capture groups (say, \1 and \2) are part of a bigger pattern that matches with backreferences to these groups, etc. So both are greedy, in that they try to capture as much as possible, only taking less when they have to. My question is: who's greedier? Does \1 get first priority, giving \2 its share only if it has to? What about: (.*)(.*)(.*) Let's assume that \1 does get first priority. Let's say it got too greedy, and then spit out a character. Who gets it first? Is it always \2 or can it be \3? Let's assume it's \2 that gets \1's rejection. If this still doesn't work, who spits out now? Does \2 spit to \3, or does \1 spit out another to \2 first?

    Read the article

  • Regular Expression problem

    - by Yatendra Goel
    I want a regex to find the following types of strings: http://anything.abc.tld http://anything.abc.tld/ where abc - abc always remains abc anything - it could be any string tld - it could be any tld (top-level-domain) like .com .net .co.in .co.uk etc. Note: The url must not contain any other thing at the end, means http://anything.abc.tld/xyz is not acceptable.

    Read the article

  • SSRS Dynamic Returning Dataset Collection Field in Expression

    - by Ray Clark
    I wrote a custom assembly to take a parameter value from the report and return a field from the dataset collection. My assembly returns the correct fields!name.value, but it shows me the string representation of it. How can I get it to resolve as the actual fields!name.value to display the actual data in the dataset? If I enter fields!name.value in manually it works fine showing me the value. If I resolve it with my custom code it display "fields!name.value" to me in the cell.

    Read the article

  • Regular Expression .net flavor

    - by user1440109
    Dont ask how this works but currently it does ("^\|(.?)\|*$")....kinda. This removes all extra pipes...part one....I have searched all over no anwser yet. I am using VB2011 beta...asp web form......vb coding though! I want to capture special character pipe (|) which is used to seperate words...i.e. car|truck|van|cycle problem is users lead with, trail with, use multiple, and use spaces before and after...i.e. |||car||truck | van || cycle. another example: george bush|micheal jordon|bill gates|steve jobs <-- this would be correct but when I do remove space it takes correct space out. so I want to get rid of whitespace leading, trailing, any space before | and space after | and only allow one pipe (|)....in between alphanumeric of course.

    Read the article

  • Ambiguous Evaluation of Lambda Expression on Array

    - by Joe
    I would like to use a lambda that adds one to x if x is equal to zero. I have tried the following expressions: t = map(lambda x: x+1 if x==0 else x, numpy.array) t = map(lambda x: x==0 and x+1 or x, numpy.array) t = numpy.apply_along_axis(lambda x: x+1 if x==0 else x, 0, numpy.array) Each of these expressions returns the following error: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() My understanding of map() and numpy.apply_along_axis() was that it would take some function and apply it to each value of an array. From the error it seems that the the lambda is being evaluated as x=array, not some value in array. What am I doing wrong? I know that I could write a function to accomplish this but I want to become more familiar with the functional programming aspects of python.

    Read the article

  • LINQ expression until to break a string

    - by wonea
    Using LINQ I'm looking to break down the following path string[], however I'd like to break it up to the point of the Binn folder. Is there a WHERE UNTIL operator in LINQ? c:\ Program Files\ Microsoft SQL Server\ MSSQL10.SQLEXPRESS\ MSSQL\ Binn\ sqlservr.exe What I'd like todo var words = from word in thepath where UNTIL thepath == "Binn" select word;

    Read the article

  • help for writting a regular expression in javascript

    - by Majesty
    Hi guys... I want to write a javascrpit code with .Split() that split a string with structure described below: The input: W1...Wn=S1...||...Sm||Sj...Sk|Y1...Yn=D1...Di||Dm...Dn|... The Output: W1...Wn=S1...||...Sm||Sj...Sk Y1...Yn=D1...Di||Dm...Dn ... I've seen the question that split this string: a=aa|b=b||b|c=cc . but my question is general case of that question. please help me... Thanks...

    Read the article

  • Perl Regular expression remove double tabs, line breaks, white spaces

    - by Scoox
    Hi guys, I want to write a perl script that removes double tabs, line breaks and white spaces. What I have so far is: $txt=~s/\r//gs; $txt=~s/ +/ /gs; $txt=~s/\t+/\t/gs; $txt=~s/[\t\n]*\n/\n/gs; $txt=~s/\n+/\n/gs; But, 1. It's not beautiful. Should be possible to do that with far less regexps. 2. It just doesn't work and I really do not know why. It leaves some double tabs, white spaces and empty lines (i.e. lines with only a tab or whitespace) I could solve it with a while, but that is very slow and ugly. Any suggestions?

    Read the article

  • Regular Expression Sanitize (PHP)

    - by atif089
    Hello, I would like to sanitize a string in to a URL so this is what I basically need. Everything must be removed except alphanumeric characters and spaces and dashed. Spaces should be converter into dashes. Eg. This, is the URL! must return this-is-the-url Thanks

    Read the article

  • Selectively search and replace certain lines using a regular expression

    - by eneveu
    I have a file containing a lot of SQL statements, such as: CREATE TABLE "USER" ( "ID" INTEGER PRIMARY KEY, "NAME" CHARACTER VARYING(50) NOT NULL, "AGE" INTEGER NOT NULL ); COPY "USER" (id, name, age) FROM stdin; 1 Skywalker 19 2 Kenobi 57 I want the column names in the COPY statements to be uppercased and quoted: COPY "USER" ("ID", "NAME", "AGE") FROM stdin; Using sed, I found the following regexp: sed -r 's/([( ])(\w+)([,)])/\1"\U\2\E"\3/g' It does replace the column names, but it is not selective enough, and replaces other words in the file: ~/test]$sed -r 's/([( ])(\w+)([,)])/\1"\U\2\E"\3/g' star_wars_example CREATE TABLE "USER" ( "ID" INTEGER PRIMARY "KEY", "NAME" CHARACTER VARYING("50")NOT "NULL", "AGE" INTEGER NOT NULL ); COPY "USER" ("ID", "NAME", "AGE") FROM stdin; 1 Skywalker 19 2 Kenobi 57 To avoid this problem, I want sed to only apply my regexp to the lines starting with COPY and ending with FROM stdin;. I have looked into lookahead / lookbehind, but they are not supported in sed. They seem to be supported in super-sed, but I am currently using Cygwin (Windows is mandatory here...) and it does not seem available in the package list. Is there a way to force sed to only consider specific line? I've considered piping my file through grep before applying sed, but other lines will then disappear from the output. Am I missing something obvious? It would be great if the answer was easily applicable on a default Cygwin install. I guess I could try installing super-sed on cygwin, but I'd like to know if there are more obvious ideas

    Read the article

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