Search Results

Search found 2490 results on 100 pages for 'matching'.

Page 17/100 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Finding all CLASSPATH resources matching a pattern

    - by binil
    I want to read a bunch of text files, by loading them as resources using the context classloader. URL url = Thread.currentThread() .getContextClassloader() .getResource("folder/foo.txt"); Is there some way to get a list of resources whose names match a given pattern? For eg: URL[] matchingUrls = someLibrary.getMatchingResources("folder/*.txt"); Libraries like Spring can scan the classpath to find classes with a given annotation, so I am wondering if there something similar to load a bunch of resources.

    Read the article

  • Full and Partial Matching of Sets

    - by jeffrey
    I have several sets of the same type [Y, M, D] and am trying to write a function to search these sets and return an array of the available sets that fit my parameters. ReturnedSets = return_matches(Y,M,D); I want the three parameters of the function return_matches to be optional. Which means any combination of values can be used to return the sets. For example, one could write - return_matches(13,null,2); - and the function would look for all sets that contain [13, anyValue, 2]; I'm writing this in PHP, to allow users to manage dated files on my website, but I'd like to be able to use this function again for other uses. Thanks! edit: (This, or variations of this, is all I can come up with so far... There is something extra that I don't understand, because this function ends up / would not work to return sets that contain y and d, but leaving m arbitrary. if(y == s[0]){ if(m == s[1]){ if(d == s[2]){ print "day match"; } } else {print "month match";} } else {print "year match";} } else {print "no match";}

    Read the article

  • Regular expression (PCRE) for url matching

    - by zerkms
    The input: we get some plain text as input string and we have to highlighight all urls there with {url For some time i've used regex taken from http://flanders.co.nz/2009/11/08/a-good-url-regular-expression-repost/, which i modified several times, but it's built for another issue - to check whether the whole input string is an url or no. So, what regex do you use in such issues?

    Read the article

  • document.URL Matching in Javascript

    - by streetparade
    I have a url which looks like this https://test.high.com/people/11111111-name-firstname-_custa/deals/new Now i need to match document.URL if im on that Page if so i will alert a message. The important part is /deals/new How can i match that in Javascript?

    Read the article

  • PHP: parse URL for matching directory /somedirectory/ and execute conditional code

    - by Scott B
    This has to be pretty simple, but I'd like to parse the current URL and execute conditional code depending on whether the user is on the /sitemap/ directory. So for example, if the site is example.com, and if the request is example.com/sitemap/. Then I want to execute conditional code in that case. I'm using wordpress so I'm not sure if there is a built-in function that gets this... A pure PHP solution is fine.

    Read the article

  • MySQL: Matching inexact values using "ON"

    - by Brad
    I'm way out of my league here... I have a mapping table (table1) to assign particular values (value) to a whole number (map_nu). My second table (table2), is a collection of averages (avg) (I couldn't figure out how to properly make a markdown table, please feel free to edit!) table1: table2: (value)(Map_nu) (avg) ---- ----- 1 1 1.111 1.045 2 1.2 1.09 3 1.33333 1.135 4 1 1.18 5 1.389 1.225 6 1.42 1.27 7 1.07 1.315 8 1.36 9 1.405 10 I need to find a way to match the averages from table2 to the closest value in table1. It only need to match to the 2 digit past the decimal, so I've added the Truncated function SELECT map_nu FROM `table1` JOIN table2 ON TRUNCATE(table1.value,2)=TRUNCATE(table2.avg,2) I still miss the values that don't match the averages exactly. Is there a way to pick the nearest truncated value? Thanks!

    Read the article

  • Cross vertion line matching.

    - by BCS
    I'm considering how to do automatic bug tracking and as part of that I'm wondering what is available to match source code line numbers (or more accurate numbers mapped from instruction pointers via something like addr2line) in one version of a program to the same line in another. (Assume everything is in some kind of source control and is available to my code) The simplest approach would be to use a diff tool/lib on the files and do some math on the line number spans, however this has some limitations: It doesn't handle cross file motion. It might not play well with lines that get changed It doesn't look at the information available in the intermediate versions. It provides no way to manually patch up lines when the diff tool gets things wrong. It's kinda clunky Before I start diving into developing something better: What already exists to do this? What features do similar system have that I've not thought of?

    Read the article

  • Matching id's in BeautifulSoup

    - by Ockonal
    Hello, I'm using BeautifulSoup - python module. I have to find any reference to the div's with id like: 'post-#'. For example: <div id="post-45">...</div> <div id="post-334">...</div> How can I filter this? html = '<div id="post-45">...</div> <div id="post-334">...</div>' soupHandler = BeautifulSoup(html) print soupHandler.findAll('div', id='post-*') > []

    Read the article

  • Simple line matching using Regex

    - by Joan Venge
    I have this string stream: "do=whoposted&amp;t=1934067" rel=nofollow>61</A></TD><TD class=alt2 align=middle>5,286</TD></TR><TR><TD id=td_threadstatusicon_1911046 class=alt1><IMG id=thread_statusicon_1911046 border=0 alt="" src="http://url.com/forum/images/statusicon/thread_new.gif"> </TD><TD class=alt2><IMG title=Node border=0 alt=Node src="http://url.com/forum/images/icons/new.png"></TD><TD id=td_threadtitle_1911046 class=alt1 title="http://lulzimg.com/i14/7bd11b.jpg &#10; &#10;Complete name : cool-thread...."><DIV><A id=thread_gotonew_1911046 href="http://url.com/forum/f80/cool-topic-new/"><IMG class=inlineimg title="Go to first new post" border=0 alt="Go to first new post" src="http://url.com/forum/images/buttons/firstnew.gif"></A> [MULTI] <A style="FONT-WEIGHT: bold" id=thread_title_1911046 href="http://url.com/forum/f80/cool-topic-name-1911046/">Cool Topic Name</A> </DIV><DIV class=smallfont><SPAN style="CURSOR: pointer" onclick="window.open('http://url.com/forum/members/u2031889/', '_self')">m3no</SPAN> </DIV></TD><TD class=alt2 title="Replies: 11, Views: 1,554"><DIV style="TEXT-ALIGN: right; WHITE-SPACE: nowrap" class=smallfont>Today <SPAN class=time>08:04 AM</SPAN><BR>by <A href="http://url.com/forum/members/u1131830/" rel=nofollow>karetsos</A> <A " The lines I am interested are similar to this: <A style="FONT-WEIGHT: bold" id=thread_title_1911046 href="http://url.com/forum/f80/cool-topic-name-1911046/">Cool Topic Name</A> From here all I am trying to extract are: Thread id: 1911046 (could be from either location in the string) Thread name: "Cool Topic Name" Thread link: "http://url.com/forum/f80/cool-topic-name-1911046/" Currently I use this: Regex pattern = new Regex ( "<A\\s+href=\"([^\"]*)\">([^\\x00]*?)\\s+id=thread_title_(\\S+)</A>" ); MatchCollection matches = pattern.Matches ( doc.ToString ( ) ); foreach ( Match match in matches ) { int id = Convert.ToInt32 ( match.Groups [ 1 ].Value ); string name = match.Groups [ 3 ].Value; string link = match.Groups [ 2 ].Value; ... } I would appreciate if someone can help me fix the pattern to match it. This used to work but it returns 0 matches.

    Read the article

  • Getting automatic matching brace in vim

    - by Bob
    I spend WAY to much time fumbling around because vim doesn't handle closing braces like most IDEs do. Here's what I want to happen: type this: if( whatever ) { <CR> where <CR> mean hit the enter key and get this: if( whatever ) { | } where | is the position of the cursor. It's what Eclipse does. It's what Visual Studio does. And it's what I want Vim to do. I've seen a few plugins, tried a few, and none of them seem to give me this behavior. Surely I can't be the first programmer to want this.

    Read the article

  • Histrogram matching - image processing - c/c++

    - by Raj
    Hello I have two histograms. int Hist1[10] = {1,4,3,5,2,5,4,6,3,2}; int Hist1[10] = {1,4,3,15,12,15,4,6,3,2}; Hist1's distribution is of type multi-modal; Hist2's distribution is of type uni-modal with single prominent peak. My questions are Is there any way that i could determine the type of distribution programmatically? How to quantify whether these two histograms are similar/dissimilar? Thanks

    Read the article

  • Matching Strings: a biological perspective

    - by sun
    Write a function, called constrainedMatchPair which takes three arguments: a tuple representing starting points for the first substring, a tuple representing starting points for the second substring, and the length of the first substring. The function should return a tuple of all members (call it n) of the first tuple for which there is an element in the second tuple (call it k) such that n+m+1 = k, where m is the length of the first substring. Complete the definition def constrainedMatchPair(firstMatch,secondMatch,length):

    Read the article

  • Need a better regex for group matching

    - by user350233
    Hi, Presently I'm using two regx: ABC.*1EFG ABC.*2HIJ to retrieve Line 1 and Line 2 from a text file. Is there a better single regex, so that both the lines(L1 and L2) from below can be matched. Line 1: ABCanystring1EFGanystring Line 2: ABCanystring2HIJanystring Line 3: ABCanystring2LMNanystring . . . Line n Thanks you in advance, Su

    Read the article

  • How do I find matching values in a generic list

    - by TDDG
    I have anywhere from 5 to 10 generic list in an ASP.NET VB.NET web app. I would like to write a method to pass them all into, and return only the elements they all have in common. I'm looking for some ideas how to accomplish this the easiest and cleanest way possible.

    Read the article

  • matching certain numbers at the end of a string

    - by user697473
    I have a vector of strings: s <- c('abc1', 'abc2', 'abc3', 'abc11', 'abc12', 'abcde1', 'abcde2', 'abcde3', 'abcde11', 'abcde12', 'nonsense') I would like a regular expression to match only the strings that begin with abc and end with 3, 11, or 12. In other words, the regex has to exclude abc1 but not abc11, abc2 but not abc12, and so on. I thought that this would be easy to do with lookahead assertions, but I haven't found a way. Is there one? EDIT: Thanks to posters below for pointing out a serious ambiguity in the original post. In reality, I have many strings. They all end in digits: some in 0, some in 9, some in the digits in between. I am looking for a regex that will match all strings except those that end with a letter followed by a 1 or a 2. (The regex should also match only those strings that start with abc, but that's an easy problem.) I tried to use negative lookahead assertions to create such a regex. But I didn't have any success.

    Read the article

  • Regular expression matching in php

    - by user1836428
    I have this regexp: /(.*)(([0-9]([^a-zA-Z])*){7,}[0-9])(.*)/. Given the following values 0654535263 065453-.-5263 065asd4535263 Expected Results 06**** 06**** 06**** Actual Results 0654535263 06**** 065asd4535263 It does not match the last row because of the letters (I want to match from 0-3 letters) and it matches only last occurence (in the second row in example, it skips first row).

    Read the article

  • Matching a String and then incrementing a number within HTML elements

    - by Abs
    Hello all, I have tags in a html list, here is an example of two tags. <div class="tags"> <ul> <li> <a onclick="tag_search('tag1');" href="#">tag1 <span class="num-active">1</span></a> </li> <li> <a onclick="tag_search('tag2');" href="#">tag2 <span class="num-active">1</span></a> </li> </ul> </div> I would like to write a function that I can pass a string to, that will match the strings in the a hyperlink i.e. "tag1" or "tag2", if there is a match then increment the number in the span, if not then add a new li. The bit I am having trouble with is how do I search for a string in the div with class tags and then when I find a match identifying the element. I can't even do the first bit as I am use to using an ID or a Class. I appreciate any help on this using JQuery Thanks all Code so far function change_tag_count(item){ alert(item);//alerts the string test $.fn.searchString = function(str) { return this.filter('*:contains("' + item + '")'); }; if($('body').searchString(item).length){ var n = $('a').searchString(item).children().text(); n = parseInt(n) + 1; $('a').searchString(item).children().text(n); }else{ alert('here');//does not alert this when no li contains the word test $("#all_tags ul").append('<a onclick="tag_search(\''+item+'\');" href="#">'+item+'<span class="num-active">1</span></a>'); } }

    Read the article

  • matching images inside a link in regex

    - by user225269
    What is wrong with regex pattern that I created: $link_image_pattern = '/\<a\shref="([^"]*)"\>\<img\s.+\><\/a\>/'; preg_match_all($link_image_pattern, $str, $link_images); What I'm trying to do is to match all the links which has images inside of them. But when I try to output $link_images it contains everything inside the first index: <pre> <?php print_r($link_images); ?> </pre> The markup looks something like this: Array ( [0] = Array ([0] = " <p>&nbsp;</p> <p><strong><a href="url">Title</a></strong></p> <p>Desc</p> <p><a href="{$image_url2}"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="{$image_url2}" width="569" height="409"></a></p> But when outputting the contents of the matches, it simply returns the first string that matches the pattern plus all the other markup in the page like this: <a href="{$image_url}"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="{$image_url}" width="568" height="347"></a></p> <p>&nbsp;</p> <p><strong><a href="url">Title</a></strong></p> <p>Desc</p> <p><a href="{$image_url2}"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="{$image_url2}" width="569" height="409"></a></p>")

    Read the article

  • Cross version line matching.

    - by BCS
    I'm considering how to do automatic bug tracking and as part of that I'm wondering what is available to match source code line numbers (or more accurate numbers mapped from instruction pointers via something like addr2line) in one version of a program to the same line in another. (Assume everything is in some kind of source control and is available to my code) The simplest approach would be to use a diff tool/lib on the files and do some math on the line number spans, however this has some limitations: It doesn't handle cross file motion. It might not play well with lines that get changed It doesn't look at the information available in the intermediate versions. It provides no way to manually patch up lines when the diff tool gets things wrong. It's kinda clunky Before I start diving into developing something better: What already exists to do this? What features do similar system have that I've not thought of?

    Read the article

  • .NET Regex - need matching string for parsing...

    - by TomTom
    Hello, I am a regex idiot and never found a good tutorial (links welcome, as well as a pointer to an interactive VS2010 integrated editor). I need to parse strings in the following form: [a/b]:c/d a, b: double with "." as possible separator. CAN be empty c: double with "." as separator d: integer, positive I.e. valid strings are: [/]:0.25/2 [-0.5/0.5]:0.05/2 [/0.1]:0.05/2 ;) Anyone can help? Thanks

    Read the article

  • Perl Matching ,Extracting , and printing emails

    - by user3448790
    How do I match an email using the The Official Standard: RFC 5322 in a html source code, after that i will extract the strings that are matched ONLY, and print out inly the emails, and not the whole source code? Is there any examples and output to illustrate this? Thnaks! elsif ($_ eq '-dDATA' or $_ eq '-ft') { opendir(DIR,'DATA'); my(@dir) = grep /\.htm/, readdir (DIR); closedir(DIR); my $value = join(@dir); print "$value\n"; foreach my $movies (@dir) { open (my $FHD, "<", "DATA/$movies") || die $!; print <$FHD>; } } }

    Read the article

  • Need a MYSQL query to compare two tables and only output non matching results

    - by ee12csvt
    I have two tables in my database, one contains a list of items with other information on these items. The other table is contains a list of photographs of these items. The items table gives each item a unique identifier,which is used in the photographs table to identifier which item has been photographed. I need to output a list of items that are not linked to a photograph in the second table. Any ideas on how I can do this?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >