Search Results

Search found 1746 results on 70 pages for 'expressions'.

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

  • Finding the html tag value with Python [on hold]

    - by MrWho
    Consider a html page, which contains a line like below: file: 'http://google.com/video.mp4' I want to search for google.com/video.mp4 in that file and save it in a variable.I want to code it with python. Shortly, I want to elicit a link from a html page, so I need to get the link by using regular expressions or the other techniques in which I'm asking about. PS: What should I exactly try to clarify?it's really annoying that the administrators don't even say what is exactly unclear about the question, they've just learned to close or on hold the topics!

    Read the article

  • What are some examples of MemberBinding linq expressions?

    - by michielvoo
    There are three possibilities, but I can't find examples: System.Linq.Expressions.MemberAssignment System.Linq.Expressions.MemberListBinding System.Linq.Expressions.MemberMemberBinding I want to write some unit tests to see if I can handle them, but I don't know how to write them except for the first one, which seems to be new Foo { Property = "value" } where Property = "value" is an expression of type MemberAssignment. See also this MSDN article.

    Read the article

  • Freely-available, well-debugged regular expressions

    - by fsb
    I was reading ICU documentation and came across this fine advice: For common tasks like this there are libraries of freely available regular expressions that have been well debugged. It's worth making a quick search before writing a new expression. To which libraries of well-debugged regular expressions do you commonly refer? I'm not much taken with http://regexlib.com where the expressions don't seem all that well debugged. It appears to have no QA process besides user comments and ratings.

    Read the article

  • C#: Is it possible to use expressions or functions as keys in a dictionary?

    - by Svish
    Would it work to use Expression<Func<T>> or Func<T> as keys in a dictionary? For example to cache the result of heavy calculations. For example, changing my very basic cache from a different question of mine a bit: public static class Cache<T> { // Alternatively using Expression<Func<T>> instead private static Dictionary<Func<T>, T> cache; static Cache() { cache = new Dictionary<Func<T>, T>(); } public static T GetResult(Func<T> f) { if (cache.ContainsKey(f)) return cache[f]; return cache[f] = f(); } } Would this even work? Edit: After a quick test, it seems like it actually works. But I discovered that it could probably be more generic, since it would now be one cache per return type... not sure how to change it so that wouldn't happen though... hmm Edit 2: Noo, wait... it actually doesn't. Well, for regular methods it does. But not for lambdas. They get various random method names even if they look the same. Oh well c",)

    Read the article

  • Building a regex builder

    - by i.h4d35
    I am a beginner in programming in general and web development in particular. I am especially bad at regular expressions. Recently I was involved in building a couple of cPanel plugins(Perl-CGI) and that's when I realized how bad I am in regex. As a result, I have decided to build an online regex builder - this will help me to learn regex and help other struggling with regex. I have checked out GSkinner, Rubular and a couple of others like regexpal. It seemed to be a little difficult to use, hence i thought of writing another one. I do not know which tool is best suited for the job. should I write it in Perl or Python? My skill level is between beginner and intermediate in both those languages. What would be a good starting point - building it for the CLI or for the browser? I plan to get a string as an input, ask if the user want to search or search and replace, enter the search string (and the replace string where applicable) and then generate a regex. Would this be the right way to go?

    Read the article

  • Documentation often ommits to specify which flavour of regular expression to use, so is there a default flavour that we should all be familiar with?

    - by JW01
    Often I come across documentation that says "use a regular expression here" I have to spend quite some time digging around trying to work out which regular expression format they are expecting. As far as I can tell, there are many types of regular expression. But, at my last place of work I was made to feel stupid when I suggested adding some text to our User Documentation to specify the type of regular expression to be used. When someone says "a regular expression" what is the regular expression syntax most people expect and where is it documented? Update: I was prompted to single-out some examples - but no disrespect to these great projects: eregi docs page is not particularly helpful in explaining expected syntax. Nor can I easily work out the syntax expected here if i just land on the page from a search. No explicit mention of the regular expression pattern expected by PatternExpectation() on the SimpleTest page. etc. etc. here is a highly voted SO answer that seems to assume there is only one flavour of regular expressions.

    Read the article

  • Perl: Negative look behind regex question [migrated]

    - by James
    The Perlre in Perldoc didn't go into much detail on negative look around but I tried testing it, and didn't work as expected. I want to see if I can differentiate a C preprocessor macro definition (e.g. #define MAX(X) ....) from actual usage (y = MAX(x);), but it didn't work as expected. my $macroName = 'MAX'; my $macroCall = "y = MAX(X);"; my $macroDef = "# define MAX(X)"; my $boundary = qr{\b$macroName\b}; my $bstr = " MAX(X)"; if($bstr =~ /$boundary/) { print "boundary: $bstr matches: $boundary\n"; } else { print "Error: no match: boundary: $bstr, $boundary\n"; } my $negLookBehind = qr{(?<!define)\b$macroName\b}; if($macroCall =~ /$negLookBehind/) # "y = MAX(X)" matches "(?<!define)\bMAX\b" { print "negative look behind: $macroCall matches: $negLookBehind\n"; } else { print "no match: negative look behind: $macroCall, $negLookBehind\n"; } if($macroDef =~ /$negLookBehind/) # "#define MAX(X)" should not match "(?<!define)\bMAX\b" { print "Error: negative look behind: $macroDef matches: $negLookBehind\n"; } else { print "no match: negative look behind: $macroDef, $negLookBehind\n"; } It seems that both $macroDef and $macroCall seem to match regex /(?<!define)\b$macroName\b/. I backed off from the original /(?<\#)\s*(?<!define)\b$macroName\b/ since that didn't work either. So what did I screw up? Also does Perl allow chaining of multiple look around expressions?

    Read the article

  • Lambda expressions in C#?

    - by user30457
    Hey I'm rather new to these could someone explain the significance or prehaps give a link to some useful information on lambda expressions? I encounter the following code in a test and I am wondering why someone would do this: foo.MyEvent += (o, e) = { fCount++; Console.WriteLine(fCount); }; foo.MyEvent -= (o, e) = { fCount++; Console.WriteLine(fCount); }; My instinct tells me it is something simple and not a mistake, but I don't know enough about these expressions to understand why this is being done. Regards,

    Read the article

  • Equivalence of boolean expressions

    - by Iulian Serbanoiu
    Hello, I have a problem that consist in comparing boolean expressions ( OR is +, AND is * ). To be more precise here is an example: I have the following expression: "A+B+C" and I want to compare it with "B+A+C". Comparing it like string is not a solution - it will tell me that the expressions don't match which is of course false. Any ideas on how to compare those expressions? Any ideas about how can I tackle this problem? I accept any kind of suggestions but (as a note) the final code in my application will be written in C++ (C accepted of course). An normal expression could contain also parenthesis: (A * B * C) + D or A+B*(C+D)+X*Y Thanks in advance, Iulian

    Read the article

  • Parse filename from full path using regular expressions in C#

    - by WindyCityEagle
    How do I pull out the filename from a full path using regular expressions in C#? Say I have the full path C:\CoolDirectory\CoolSubdirectory\CoolFile.txt. How do I get out CoolFile.txt using the .NET flavor of regular expressions? I'm not really good with regular expressions, and my RegEx buddy and me couldn't figure this one out. Also, in the course of trying to solve this problem, I realized that I can just use System.IO.Path.GetFileName, but the fact that I couldn't figure out the regular expression is just making me unhappy and it's going to bother me until I know what the answer is.

    Read the article

  • Delphi component or library to display mathematical expressions

    - by Svein Bringsli
    I'm looking for a simple component that displays mathematical expressions in Delphi. When I started out I thought it would be easy to find something on the net, but it turns out it was harder than anticipated. There are lots and lots of components that will parse mathematical expressions, but few (none?) that will display them. Ideally I would like a component as simple as a TLabel, where I could set the caption to some expression and it would be displayed correctly, but some sort of library that let's me draw expressions to a canvas would also be sufficient for my needs. Update: I'm not talking about plotting graphs of functions or something like that. I want to display (for instance) (X^2+3)/X like this:

    Read the article

  • O&rsquo;Reilly Deals to 9/June/2014 05:00 PT&ndash;50% off E-Books on Regular Expressions

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2014/06/06/orsquoreilly-deals-to-9june2014-0500-ptndash50-off-e-books-on-regular.aspxUntil 9/June/2014 05:00 PT, O’Reilly are offering 50% off E-Books on Regular Expressions at http://shop.oreilly.com/category/deals/regular-expressions-owo.do?code=DEAL&imm_mid=0bd938&cmp=em-prog-books-videos-lp-dod_regex. “Regular expressions—powerful tools for manipulating text and data—are now standard features in most languages and tools. Yet despite their widespread availability and unparalleled power, regular expressions are frequently underused. With ebooks and videos from shop.oreilly.com, learn tips for matching, extracting, and transforming text and data. Today only, save 50% and discover the epic functionality of Reg Ex.”

    Read the article

  • Vipul Lavanya Sector 81 Gurgaon 09899299961 Resale Urban Expressions Property

    - by amit
    2, 3, 4 BHK Resale Urban Expressions Property Research 09899299961 Vipul Lavanya Gurgaon. {RESIDENTIAL} Vipul 2/3/4 BHK Residential Apartments for Sale in * Vipul LAVANYA * Sector-81 Near Upcoming Metro Station & 500 Mtrs away from Northern Periphery Expressway (Dwarka Expressway)& Gurgaon - Jaipur Expressway (N.H.8) Near IMT Manesar one of the Biggest Industrial HUB in NCR Zone Please Contact for More Details & Informations: Vipul Lavanya Gurgaon Located In Sector 81 on NH 8 Gurgaon

    Read the article

  • Multiple group expressions in list (ssrs 2005)

    - by Kris
    Hi, I have a problem with group expressions in a list. I want to use two expressions: '=Ceiling(RowNumber(Nothing)/3)' and '=Cint(Fields!kpilevel.Value)' They work both individually, but when I insert them together only 1 works. I inserted them like this: http://img718.imageshack.us/img718/736/problemxq.png Does anyone know how to solve this? Thanks in advance, Kris

    Read the article

  • Database model for saving random boolean expressions

    - by zarko.susnjar
    I have expressions like this: (cat OR cats OR kitten OR kitty) AND (dog OR dogs) NOT (pigeon OR firefly) Anyone having idea how to make tables to save those? Before I got request for usage of brackets, I limited usage of operators to avoid ambiguous situations. So only ANDs and NOTs or only ORs and saved those in this manner: operators id | name 1 | AND 2 | OR 3 | NOT keywords id | keyword 1 | cat 2 | dog 3 | firefly expressions id | operator | keywordId 1 | 0 | 1 1 | 1 | 2 1 | 3 | 3 which was: cat AND dog NOT firefly But now, I'm really puzzled...

    Read the article

  • Regular Expression HTML tags

    - by user134615
    I'd like to know whether it exists a way to put the following HTML tags in a regex. What I want is a regex that can match all the start tags with their corresponding closing tags. E.g., Hello There might be more tags inside. I had thought of something like this: ^<([a-z]+)([^<]+)(?:(.)</\1|\s+/)$/, but it wont work. Sorry if this question doesnt belong to this section. Thank you.

    Read the article

  • Regex syntax question - trying to understand

    - by Asaf Chertkoff
    i don't know if this question belong here or no, but it is worth a shot. i'm a self taught php programmer and i'm only now starting to grasp the regex stuff. i'm pretty aware of its capabilities when it is done right, but this is something i need to dive in too. so maybe someone can help me, and save me so hours of experiment. i have this string: here is the <a href="http://www.google.com" class="ttt" title="here"><img src="http://www.somewhere.com/1.png" alt="some' /></a> and there is <a href="#not">not</a> a chance... now, i need to perg_match this string and search for the a href tag that has an image in it, and replace it with the same tag with a small difference: after the title attribute inside the tag, i'll want to add a rel="here" attribute. of course, it should ignore links (a href's) that doesn't have img tag inside. help will be appreciated, thanks.

    Read the article

  • What is the best strategy for transforming unicode strings into filenames?

    - by David Cowden
    I have a bunch (thousands) of resources in an RDF/XML file. I am writing a certain subset of the resources to files -- one file for each, and I'm using the resource's title property as the file name. However, the titles are every day article, website, and blog post titles, so they contain characters unsafe for a URI (the necessary step for constructing a valid file path). I know of the Jersey UriBuilder but I can't quite get it to work for my needs as I detailed in a different question on SO. Some possibilities I have considered are: Since each resource should also have an associated URL, I could try to use the name of the file on the server. The down side of this is sometimes people don't name their content logically and I think the title of an article better reflects the content that will be in each text file. Construct a white list of valid characters and parse the string myself defining substitutions for unsafe characters. The downside of this is the result could be just as unreadable as the former solution because presumably the content creators went through a similar process when placing the files on their server. Choose a more generic naming scheme, place the title in the text file along with the other attributes, and tell my boss to live with it. So my question here is, what methods work well for dealing with a scenario where you need to construct file names out of strings with potentially unsafe characters? Is there a solution that better fills out my constraints?

    Read the article

  • How I use RegExp in my Java program? [migrated]

    - by MIH1406
    I have the following string examples: 00001 1 12 123 00002 3 7 321 00003 99 23 332 00004 192 50 912 In a separate text file. Numbers are separated by tabs not spaces. I tried to read the file and print each line if it matches a given RegExp, but I could not find the suitable RegExp for these lines. private static void readFile() { String fileName = "processes.lst"; FileReader file = null; String result = ""; try { file = new FileReader(fileName); BufferedReader reader = new BufferedReader(file); String line = null; String regEx = "[0-9]\t[0-9]\t[0-9]\t[0-9]"; while((line = reader.readLine()) != null) { if(line.matches(regEx)) { result += "\n" + line; } } } catch(Exception e) { System.out.println(e.getMessage()); } finally { if(file != null) try { file.close(); } catch(Exception e) { System.out.println(e.getMessage()); } } System.out.println(result); } I ended up without any string being printed!!

    Read the article

  • String patterns that can be used to filter and group files

    - by Louis Rhys
    One of our application filters files in certain directory, extract some data from it and export a document from the extracted data. The algorithm for extracting the data depends on the file, and so far we use regex to select the algorithm to be used, for example .*\.txt will be processed by algorithm A, foo[0-5]\.xml will be processed by algo B, etc. However now we need some files to be processed together. For example, in one case we need two files, foo.*\.xml and bar.*\.xml. Part of the information to be extracted exist in the foo file, and the other part in the bar file. Moreover, we need to make sure the wild card is compatible. For example, if there are 6 files foo1.xml foo23.xml bar1.xml bar9.xml bar23.xml foo4.xml I would expect foo1 and bar1 to be identified as a group, and foo23 and bar23 as another group. bar9 and foo4 has no pair, so they will not be treated. Now, since the filter is configured by user, we need to have a pattern that can express the above requirement. I don't think you can express meaning like above in standard regex. (foo|bar).*\.xml will match all 6 file above and we can't identify which file is paired for a particular file. Is there any standard pattern that can express it? Or any idea how to modify regex to support this, that can be implemented easily?

    Read the article

  • Regex to String generation

    - by Mifmif
    Let's say that we have a regex and an index i , if we suppose that the set of string that match our regex are sorted in a lexicographical order, how could we get the i element of this list ? Edit : I added this simple example for more explanation : input : regex="[a-c]{1,2}"; index=4; in this case the ordered list of string that matches this regex contains those elements : a aa ab ac b ba bb bc c ca cb cc output : the 4th element which is ac ps: it's known that the string list that match the regex have infinite element, this doesn't have an impact on the proccess of extracting the element in the given index.

    Read the article

  • how to speed up this code? [migrated]

    - by dot
    I have some code that's taking over 3 seconds to complete. I'm just wondering if there's a faster way to do this. I have a string with anywhere from 10 to 70 rows of data. I break it up into an array and then loop through the array to find specific patterns. $this->_data = str_replace(chr(27)," ",$this->_data,$count);//strip out esc character $this->_data = explode("\r\n", $this->_data); $detailsArray = array(); foreach ($this->_data as $details) { $pattern = '/(\s+)([0-9a-z]*)(\s+)(100\/1000T|10|1000SX|\s+)(\s*)(\|)(\s+)(\w+)(\s+)(\w+)(\s+)(\w+)(\s+)(1000FDx|10HDx|100HDx|10FDx|100FDx|\s+)(\s*)(\w+)(\s*)(\w+|\s+)(\s*)(0)/i'; if (preg_match($pattern, $details, $matches)) { array_push($detailsArray, array( 'Port' => $matches[2], 'Type' => $matches[4], 'Alert' => $matches[8], 'Enabled' => $matches[10], 'Status' => $matches[12], 'Mode' => $matches[14], 'MDIMode' => $matches[16], 'FlowCtrl' => $matches[18], 'BcastLimit' => $matches[20])); }//end if }//end for $this->_data = $detailsArray; Just wondering if you think there's a way to make it more efficient. Thanks.

    Read the article

  • Mircosoft Expressions rejecting FP extensions

    - by Moe
    Hey there, I've just moved to a new server and I can't seem to get FrontPage extensions to work with Mircosoft Expressions. I like to edit my site Live rather then local to server. But Now, when I access my domain.. eg: http://domain.com It'll come up with: Access Denied. And if I click details it returns 501 Method Not Implemented Method Not Implemented GET to / not supported. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. If I define (in .htaccess): ErrorDocument 404 /404.php The Details returns the Title and contents of 404.php. And if I define (in .htaccess): ErrorDocument 404 /404.php ErrorDocument 501 /501.php The Details return nothing. What Am I doing wrong? Thanks.

    Read the article

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