Search Results

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

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

  • Help updating cron entry using regular expressions

    - by Uday
    hi I am trying to update a cron entry NOT by using crontab -e but by shell commands. For example the cron entry is like this: 10 * * * * /home/localuser/foo.sh -b 1 -h 4 > foo_output.sh 2>&1 No i need edit the command line parameters part ONLY i.e -b 1 -h 4 to something else which will be coming in from the user. First thing would be to write the crontab to a tmp file and then manipulate that temp file. Now, is there an easy way to edit that line using SED or something? The crude way wud be to delete that entire line, write a new line with the entire expression and then load that into the cron. I am not very good with regular expressions. My system supports sed -i so was thinking this could be done in a single line command. Thanks in advance

    Read the article

  • Visual Studio Find and Replace Regular Expressions ~ find lines with quoted strings, not containing

    - by Darkoni
    Visual Studio Find and Replace Regular Expressions Find lines with quoted strings, not containing strings include or trace i am tryling to find out all lines in c++ project that contains some text as i have to use visual studio, i have to use its Find and Replace http://www.codinghorror.com/blog/2006/07/the-visual-studio-ide-and-regular-expressions.html so, for finding all lines like: print("abc"); it is enogh to write :q and it will find all quotted strings ok, but i also get lot of lines like #include "stdio.h" and trace("* step 1 *") i find out regex to get all lines containing include and trace <include|trace> so, mine question is, how to find all lines with "quotted strings" but NOT lines that contains strings include and trace. thanx

    Read the article

  • Regular expression for Regular expressions?

    - by kavoir.com
    I have an app that enables the user to input a regular expression, my question is how to check against any input of regular expressions and make sure they are valid ones because if they are not there will be preg_match errors. I don't want to use the '@' before preg_match, so if there's a way to check the validity of the user input of regular expressions that'd be great. The regular expression system of PHP seems to be rather too complicated for me to come up with a regular expression for them. Any idea or any alternatives would be possible in achieving this?

    Read the article

  • Double interpolation of regular expressions in Perl

    - by tomdee
    I have a Perl program that stores regular expressions in configuration files. They are in the form: regex = ^/d+$ Elsewhere, the regex gets parsed from the file and stored in a variable - $regex. I then use the variable when checking the regex, e.g. $lValid = ($valuetocheck =~ /$regex/); I want to be able to include perl variables in the config file, e.g. regex = ^\d+$stored_regex$ But I can't work out how to do it. When regular expressions are parsed by Perl they get interpreted twice. First the variables are expanded, and then the the regular expression itself is parsed. What I need is a three stage process: First interpolate $regex, then interpolate the variables it contains and then parse the resulting regular expression. Both the first two interpolations need to be "regular expression aware". e.g. they should know that the string contain $ as an anchor etc... Any ideas?

    Read the article

  • Lua pattern matching vs. regular expressions

    - by harald
    hello, i'm currently learning lua. regarding pattern-matching in lua i found the following sentence in the lua documentation on lua.org: Nevertheless, pattern matching in Lua is a powerful tool and includes some features that are difficult to match with standard POSIX implementations. as i'm familiar with posix regular expressions i would like to know if there are any common samples where lua pattern matching is "better" compared to regular expression -- or did i misinterpret the sentence? and if there are any common examples: why is any of pattern-matching vs. regular expressions better suited? thanks very much, harald

    Read the article

  • lambda expressions in C#?

    - by Matt
    Hey I'm rather new to these could someone explain the significance (of the following code) 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

  • Regular expressions in findstr

    - by Johannes Rössel
    I'm doing a little string validation with findstr and its /r flag to allow for regular expressions. In particular I'd like to validate integers. The regex ^[0-9][0-9]*$ worked fine for non-negative numbers but since I now support negative numbers as well I tried ^([1-9][0-9]*|0|-[1-9][0-9]*)$ for either positive or negative integers or zero. The regex works fine theoretically. I tested it in PowerShell and it matches what I want. However, with findstr /r /c:"^([1-9][0-9]*|0|-[1-9][0-9]*)$" it doesn't. While I know that findstr doesn't have the most advanced regex support (even below Notepad++ which is probably quite an achievement), I would have expected such simple expressions to work. Any ideas what I'm doing wrong here?

    Read the article

  • Using numeric_limits::max() in constant expressions

    - by FireAphis
    Hello, I would like to define inside a class a constant which value is the maximum possible int. Something like this: class A { ... static const int ERROR_VALUE = std::numeric_limits<int>::max(); ... } This declaration fails to compile with the following message: numeric.cpp:8: error: 'std::numeric_limits::max()' cannot appear in a constant-expression numeric.cpp:8: error: a function call cannot appear in a constant-expression I understand why this doesn't work, but two things look weird to me: It seems to me a natural decision to use the value in constant expressions. Why did the language designers decide to make max() a function thus not allowing this usage? The spec claims in 18.2.1 that For all members declared static const in the numeric_limits template, specializations shall define these values in such a way that they are usable as integral constant expressions. Doesn't it mean that I should be able to use it in my scenario and doesn't it contradict the error message? Thank you.

    Read the article

  • Code Golf: Evaluating Mathematical Expressions

    - by Noldorin
    Challenge Here is the challenge (of my own invention, though I wouldn't be surprised if it has previously appeared elsewhere on the web). Write a function that takes a single argument that is a string representation of a simple mathematical expression and evaluates it as a floating point value. A "simple expression" may include any of the following: positive or negative decimal numbers, +, -, *, /, (, ). Expressions use (normal) infix notation. Operators should be evaluated in the order they appear, i.e. not as in BODMAS, though brackets should be correctly observed, of course. The function should return the correct result for any possible expression of this form. However, the function does not have to handle malformed expressions (i.e. ones with bad syntax). Examples of expressions: 1 + 3 / -8 = -0.5 (No BODMAS) 2*3*4*5+99 = 219 4 * (9 - 4) / (2 * 6 - 2) + 8 = 10 1 + ((123 * 3 - 69) / 100) = 4 2.45/8.5*9.27+(5*0.0023) = 2.68... Rules I anticipate some form of "cheating"/craftiness here, so please let me forewarn against it! By cheating, I refer to the use of the eval or equivalent function in dynamic languages such as JavaScript or PHP, or equally compiling and executing code on the fly. (I think my specification of "no BODMAS" has pretty much guaranteed this however.) Apart from that, there are no restrictions. I anticipate a few Regex solutions here, but it would be nice to see more than just that. Now, I'm mainly interested in a C#/.NET solution here, but any other language would be perfectly acceptable too (in particular, F# and Python for the functional/mixed approaches). I haven't yet decided whether I'm going to accept the shortest or most ingenious solution (at least for the language) as the answer, but I would welcome any form of solution in any language, except what I've just prohibited above! My Solution I've now posted my C# solution here (403 chars). Update: My new solution has beaten the old one significantly at 294 chars, with the help of a bit of lovely regex! I suspected that this will get easily beaten by some of the languages out there with lighter syntax (particularly the funcional/dynamic ones), and have been proved right, but I'd be curious if someone could beat this in C# still. Update I've seen some very crafty solutions already. Thanks to everyone who has posted one. Although I haven't tested any of them yet, I'm going to trust people and assume they at least work with all of the given examples. Just for the note, re-entrancy (i.e. thread-safety) is not a requirement for the function, though it is a bonus. Format Please post all answers in the following format for the purpose of easy comparison: Language Number of characters: ??? Fully obfuscated function: (code here) Clear/semi-obfuscated function: (code here) Any notes on the algorithm/clever shortcuts it takes.

    Read the article

  • .NET Regular expressions on bytes instead of chars

    - by brickner
    Hi, I'm trying to do some parsing that will be easier using regular expressions. The input is an array (or enumeration) of bytes. I don't want to convert the bytes to chars for the following reasons: Computation efficiency Memory consumption efficiency Some non-printable bytes might be complex to convert to chars. Not all the bytes are printable. So I can't use Regex. The only solution I know, is using Boost.Regex (which works on bytes - C chars), but this is a C++ library that wrapping using C++/CLI will take considerable work. How can I use regular expressions on bytes in .NET directly, without working with .NET strings and chars? Thank you.

    Read the article

  • Add values to standard expressions list in Regular Expression Editor dialog in VS 2008

    - by Alex
    Hi. In the "Regular Expression Editor" dialog in VS 2008 ( or 2005 for this matter ) , there is a list of "standard expressions" like : "French phone number" , "French postal code" etc.. And of course there is an option to select a "Custom" and then enter your own regular expression. Well.. I want to add a predefined expressions to that list . Like : "Israeli phone number" . I don't want to enter it every time by selecting a custom value . I want my developers in the team available items for them to choose. Anyone knows how to alter that list ? I've found some question about it on the web - and the answer given is that it's not possible . But that was at 2004. Anyone ?!?! Thanks.

    Read the article

  • Insert string from database into an aspx and have databinding expressions within that text evaluated

    - by Christopher Edwards
    Well, as you can see I want something quick-and-dirty! How can I get a string from a db that has aspx databinding syntax in it and have the databinding expressions evaluated? So I have text such as this stored in the DB:- Hello <%=User.Name %> I haven't seen you since <%=User.LastVisit %> And I want it to be inserted here say:- ... <body> <form id="form1" runat="server"> <div> <asp:FormView ID="FormView1" DataSourceID="DataSource1" runat="server"> <ItemTemplate> <-- insert stuff here! --> ... But with the databinding expressions evaluated. I'd rather not build a full parsing, templating and evaluation engine...

    Read the article

  • php array regular expressions

    - by bell
    I am using regular expressions in php to match postcodes found in a string. The results are being returned as an array, I was wondering if there is any way to assign variables to each of the results, something like $postcode1 = first match found $postcode2 = second match found here is my code $html = "some text here bt123ab and another postcode bt112cd"; preg_match_all("/([a-zA-Z]{2})([0-9]{2,3})([a-zA-Z]{2})/", $html, $matches, PREG_SET_ORDER); foreach ($matches as $val) { echo $val[0]; } I am very new to regular expressions and php, forgive me if this is a stupid question. Thanks in advance

    Read the article

  • template expressions and visual studio 2005 c++

    - by chris
    I'd like to build the olb3d library with my visual studio 2005 compiler but this failes due to template errors. To be more specific, the following expression seem to be a problem: void function(T u[Lattice::d]) On the website of the project is stated that prpably my compiler is not capable of such complicated template expressions - one should use the gcc 3.4.1. My question is now if there is a way to upgrade my vs c++ compiler so it can handle template expressions on the level as the gcc 3.4.1? Maybe it helps if I get a newer version of visual studio? Cheers C.

    Read the article

  • Getting started with character and text processing (encoding, regular expressions)

    - by TK
    I'd like to learn foundations of encodings, characters and text. Understanding these is important for dealing with a large set of text whether that are log files or text source for building algorithms for collective intelligence. My current knowledge is pretty basic: something like "As long as I use UTF-8, I'm okay." I don't say I need to learn about advanced topics right away. But I need to know: Bit and bytes level knowledge of encodings. Characters and alphabets not used in English. Multi-byte encodings. (I understand some Chinese and Japanese. And parsing them is important.) Regular expressions. Algorithm for text processing. Parsing natural languages. I also need an understanding of mathematics and corpus linguistics. The current and future web (semantic, intelligent, real-time web) needs processing, parsing and analyzing large text. I'm looking for some resources (maybe books?) that get me started with some of the bullets. (I find many helpful discussion on regular expressions here on Stack Overflow. So, you don't need to suggest resources on that topic.)

    Read the article

  • Java remove HTML from String without regular expressions

    - by behrk2
    Hello, I am trying to remove all HTML elements from a String. Unfortunately, I cannot use regular expressions because I am developing on the Blackberry platform and regular expressions are not yet supported. Is there any other way that I can remove HTML from a string? I read somewhere that you can use a DOM Parser, but I couldn't find much on it. Text with HTML: <![CDATA[As a massive asteroid hurtles toward Earth, NASA head honcho Dan Truman (<a href="http://www.netflix.com/RoleDisplay/Billy_Bob_Thornton/20000303">Billy Bob Thornton</a>) hatches a plan to split the deadly rock in two before it annihilates the entire planet, calling on Harry Stamper (<a href="http://www.netflix.com/RoleDisplay/Bruce_Willis/99786">Bruce Willis</a>) -- the world's finest oil driller -- to head up the mission. With time rapidly running out, Stamper assembles a crack team and blasts off into space to attempt the treacherous task. <a href="http://www.netflix.com/RoleDisplay/Ben_Affleck/20000016">Ben Affleck</a> and <a href="http://www.netflix.com/RoleDisplay/Liv_Tyler/162745">Liv Tyler</a> co-star.]]> Text without HTML: As a massive asteroid hurtles toward Earth, NASA head honcho Dan Truman (Billy Bob Thornton) hatches a plan to split the deadly rock in two before it annihilates the entire planet, calling on Harry Stamper (Bruce Willis) -- the world's finest oil driller -- to head up the mission. With time rapidly running out, Stamper assembles a crack team and blasts off into space to attempt the treacherous task.Ben Affleck and Liv Tyler co-star. Thanks!

    Read the article

  • How to embed XBase expressions in an Xtext DSL

    - by Marcus Mathioudakis
    I am writing a simple little DSL for specifying constraints on messages, and Have been trying without success for a while to embed XBase expressions into the language. The Grammar looks like this: grammar org.xtext.businessrules.BusinessRules with org.eclipse.xtext.xbase.Xbase //import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes generate businessRules "http://www.xtext.org/businessrules/BusinessRules" Start: rules+=Constraint*; Constraint: {Constraint} 'FOR' 'PAYLOAD' payload=PAYLOAD 'ELEMENT' element=ID 'CONSTRAINED BY' constraint=XExpression; PAYLOAD: "SimulationSessionEvents" |"stacons" |"any" ; Range: 'above' min=INT ('below' max=INT)? |'below' max=INT ('above' min=INT)? ; When trying to parse a file such as: FOR PAYLOAD SimulationSessionEvents ELEMENT matrix CONSTRAINED BY ... I can't get it to work for ... = any kind of Arithmetic expression, although it works for ...= loop or if expression, or even just a number. As soon as I do something like '-5' or '4-5' it says Couldn't resolve reference to JvmIdentifiableElement '-', even though the Xbase.xtext Grammar looks like it allows these expressions. I don't think I'm missing any Jars, as it doesn't complain when I run the mwe workflow, but only when trying to parse the input file. Any help would be much appreciated.

    Read the article

  • Square Brackets in Python Regular Expressions (re.sub)

    - by user1479984
    I'm migrating wiki pages from the FlexWiki engine to the FOSwiki engine using Python regular expressions to handle the differences between the two engines' markup languages. The FlexWiki markup and the FOSwiki markup, for reference. Most of the conversion works very well, except when I try to convert the renamed links. Both wikis support renamed links in their markup. For example, Flexwiki uses: "Link To Wikipedia":[http://www.wikipedia.org/] FOSwiki uses: [[http://www.wikipedia.org/][Link To Wikipedia]] both of which produce something that looks like I'm using the regular expression renameLink = re.compile ("\"(?P<linkName>[^\"]+)\":\[(?P<linkTarget>[^\[\]]+)\]") to parse out the link elements from the FlexWiki markup, which after running through something like "Link Name":[LinkTarget] is reliably producing groups <linkName> = Link Name <linkTarget = LinkTarget My issue occurs when I try to use re.sub to insert the parsed content into the FOSwiki markup. My experience with regular expressions isn't anything to write home about, but I'm under the impression that, given the groups <linkName> = Link Name <linkTarget = LinkTarget a line like line = renameLink.sub ( "[[\g<linkTarget>][\g<linkName>]]" , line ) should produce [[LinkTarget][Link Name]] However, in the output to the text files I'm getting [[LinkTarget [[Link Name]] which breaks the renamed links. After a little bit of fiddling I managed a workaround, where line = renameLink.sub ( "[[\g<linkTarget>][ [\g<linkName>]]" , line ) produces [[LinkTarget][ [[Link Name]] which, when displayed in FOSwiki looks like <[[Link Name> <--- Which WORKS, but isn't very pretty. I've also tried line = renameLink.sub ( "[[\g<linkTarget>]" + "[\g<linkName>]]" , line ) which is producing [[linkTarget [[linkName]] There are probably thousands of instances of these renamed links in the pages I'm trying to convert, so fixing it by hand isn't any good. For the record I've run the script under Python 2.5.4 and Python 2.7.3, and gotten the same results. Am I missing something really obvious with the syntax? Or is there an easy workaround?

    Read the article

  • Detecting that a MemberExpression has a value

    - by cs
    How do I detect if a MemberExpression has a value that needs to be compiled/evaluated? I have two separate member expression outputs, the first which has a value, and the second which doesn't. What is the best way to differentiate between the two? exp **{value(Microsoft.Connect.Api.Client.Tests.SearchQueryUnitTests+<>c__DisplayClass6).handle}** [System.Linq.Expressions.MemberExpression]: **{value(Microsoft.Connect.Api.Client.Tests.SearchQueryUnitTests+<>c__DisplayClass6).handle}** NodeType: MemberAccess Type: {Name = "String" FullName = "System.String"} vs exp {x.CreatedBy} [System.Linq.Expressions.MemberExpression]: {x.CreatedBy} NodeType: MemberAccess Type: {Name = "String" FullName = "System.String"}

    Read the article

  • Interpreting regular expressions using find in Linux confusion

    - by PeanutsMonkey
    I am attempting to use the find command and came across an article at http://www.linux.ie/newusers/beginners-linux-guide/find.php which states The wildcard character is escaped with a slash so BASH sends a literal asterisk to the find utility as an argument instead of performing filename expansion and passing any number of files in as arguments. for the command find . -name up\*. Being new to the world of Linux I don't quite understand how the use of a backslash which is meant to escape the meta character * is interpreted and returns results as though as it is being passed to find. Does it mean if I use the -name option I have to use a backslash to pass a wildcard and if I don't use -name I don't have to use a backslash?

    Read the article

  • VBScript Regular Expressions to check IP address validity with some adtional characters

    - by yael
    How to create VB script Irregular expression syntax to check the VPparam (IP address validity) When the last octatat of the IP address is a range between ip's (x-y) and between each IP we can put the "," separator in order to add another IP example of VBparam VBparam=172.17.202.1-20 VBparam=172.17.202.1-10,192.9.200.1-100 VBparam=172.17.202.1-10,192.9.200.1-100,180.1.1.1-20 THX yael

    Read the article

  • Notepad++ Search & Replace with Regular Expressions

    - by Jeremy
    I know its simple, but I can't get it to work... I have a strings like {span style="display:none"}123{/span} and {span style="display:none"}456{/span} and {span style="display:none"}789{/span} in a file. I want to remove all of these string. So, I thought a simple regular expression replace in NotePad++ should be like "{span style="display:none"}[(.)]{/span}" - but, this is not working. Thank for your help!

    Read the article

  • Notepad++ Search & Replace with Regular Expressions

    - by Jeremy
    I know its simple, but I can't get it to work... I have a strings like {span style="display:none"}123{/span} and {span style="display:none"}456{/span} and {span style="display:none"}789{/span} in a file. I want to remove all of these string. So, I thought a simple regular expression replace in NotePad++ should be like {span style="display:none"}[(.)]{/span} but, this is not working. Thank for your help!

    Read the article

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