Search Results

Search found 2819 results on 113 pages for 'conditional expressions'.

Page 60/113 | < Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >

  • With PHP preg_match_all, get value of href

    - by Jeremy Dicaire
    Hi, I don'T really understabd how regular expressions works even after I read this tutorial http://www.webcheatsheet.com/php/regular_expressions.php Here is what I need to find: And it should return: http://link Here is what I tried: $find = preg_match_all('/<link type="text/html" rel="alternate" href=".*',$file,$patterns2); You can laught :) Thanks in advance for your help and your time :)

    Read the article

  • Question regarding php Regular expression filenames

    - by jason
    I am very bad at regular expressions, but I have a regular expression that is working okay, except for one issue: /\/(.*?).php/ I only need this regular expression to find things like: /this-a-valid-page.php {some words here} /anotherpage.php { some words here} http://www.google.com but do not find URLs the problem i am having is that it find this parts of full URLS i want it to avoid these all together. http://www.google.com/page.php because i have another function that does something different than the filename reg exp.

    Read the article

  • In MS Access form, how to color background of selected record?

    - by PowerUser
    I have a somewhat complicated looking Access Form with a continuous display (meaning multiple records are shown at once). I'd like to change the background color of the selected record only so the end-user can easily tell which record they are on. I'm thinking of perhaps a conditional format or maybe something like this: Private Sub Detail_HasFocus() Detail.BackColor(me.color)=vbBlue End Sub and something similar for when that row loses focus. This code snippet obviously won't work, but it's the kind of code I'd like to achieve.

    Read the article

  • Looking for Programming Language that allows you to change true and false.

    - by Maushu
    For my curiosity sake I'm looking for a dynamic object oriented language that allows you to change true to false and vice versa. Something like this: true = false, false = true; This should also affect any conditional statements, therefore 42 == 42 should return False. Basically, with this premise, nothing in the language would be safe from the programmer. Is there any language like this?

    Read the article

  • How should I write this string-prefix check so that it's idiomatic Python?

    - by Kevin Stargel
    I have a couple of lists of items: specials = ['apple', 'banana', 'cherry', ...] smoothies = ['banana-apple', 'mocha mango', ...] I want to make a new list, special_smoothies, consisting of elements in smoothies that start with the elements in specials. However, if specials is blank, special_smoothies should be identical to smoothies. What's the most Pythonic way to do this? Is there a way to do this without a separate conditional check on whether specials is blank?

    Read the article

  • Delete all characters in a multline string up to a given pattern

    - by biffabacon
    Using Python I need to delete all charaters in a multiline string up to the first occurrence of a given pattern. In Perl this can be done using regular expressions with something like: #remove all chars up to first occurrence of cat or dog or rat $pattern = 'cat|dog|rat' $pagetext =~ s/(.*?)($pattern)/$2/xms; What's the best way to do it in Python?

    Read the article

  • Big, Thick Reference Books (PHP / MySQL / Unix) [closed]

    - by Josh K
    I'm looking for in-depth reference books / guides in PHP, MySQL, and Unix. I'm aware there other other questions pertaining to good books for short references of function names, or detailed beginner guides to these systems. I'm looking for something different. I want a book that I can either use as a quick but in-depth (decent write up, not a pocket reference guide) reference to common functions (JOINS, string manipulation, Regular Expressions, etc) while also providing a detailed inner workings explanation on the system itself.

    Read the article

  • LINQ problem on remote machine

    - by HaMMeR
    I am using LINQ expressions in my code like this var obj = Collection.Single(collection = (collection.ShortName.Equals("AAA"))); The problem is that this line works fine for me, no problems. But when I upload the same executable to some remote machine with same 32 bit Windows XP. The code execution is just stopping at this line of source. Can anyone help me.

    Read the article

  • Ternary operator in if-statement?

    - by Pindatjuh
    I've written the following if-statement in Java: if(methodName.equals("set" + this.name) || isBoolean() ? methodName.equals("is" + this.name) : methodName.equals("get" + this.name)) { ... } Is this a good practice to write such expressions in if, to separate state from condition? And can this expression be simplified?

    Read the article

  • Passing URL as parameter using mod_rewrite

    - by Dusan
    I would like to rewrite dynamic URL /index.php?pid=login&redirect=/previous-page.html to something like this /login.html-r-previous-page.html I tried this RewriteRule ^login.html-r-(.*)$ /index.php?pid=login&redirect=$1 [L] But no succes. I was also trying to change the regex to .+ or some other forms, but it seems useless. Maybe I am making mistake somewhere else. I am new to regular expressions and also mod_rewrite. Thank you for help

    Read the article

  • php Dollar amount Regular Expression

    - by Thildemar
    I am have completed javascript validation of a form using Regular Expressions and am now working on redundant verification server-side using PHP. I have copied this regular expression from my jscript code that finds dollar values, and reformed it to a PHP friendly format: /\$?((\d{1,3}(,\d{3})*)|(\d+))(\.\d{2})?$/ Specifically: if (preg_match("/\$?((\d{1,3}(,\d{3})*)|(\d+))(\.\d{2})?$/", $_POST["cost"])){} While the expression works great in javascript I get : Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 when I run it in PHP. Anyone have a clue why this error is coming up?

    Read the article

  • Get string value from http response with Mechanize

    - by Gearóid
    Hi, I'm currently integrating facebook into my current app and I've succeeded in retrieving the access_token using the following code: url="#{url}?#{client_id}&#{client_secret}&#{code}&#{redirect_uri}&type=client_cred" agent = Mechanize.new page = agent.get(url) The page object above has a body which contains text something along the lines of access_token=XXXXX I just want to pull out the access_token value. I can get the entire string simply by writing: page.body But I was wondering is there a way to get the access_token value without resorting to regular expressions etc? Thanks.

    Read the article

  • Why does ghci say that 1.1 + 1.1 + 1.1 > 3.3 is True?

    - by Frerich Raabe
    I've been going through a Haskell tutorial recently and noticed this behaviour when trying some simple Haskell expressions in the interactive ghci shell: Prelude> 1.1 + 1.1 == 2.2 True Prelude> 1.1 + 1.1 + 1.1 == 3.3 False Prelude> 1.1 + 1.1 + 1.1 > 3.3 True Prelude> 1.1 + 1.1 + 1.1 3.3000000000000003 Does anybody know why that is?

    Read the article

  • PHP curly string syntax question

    - by zildjohn01
    I'm running PHP 5.3.0. I've found that the curly string syntax only works when the first character of the expression is $. Is there a way to include other types of expressions (function calls, etc)? Trivial example: <?php $x = '05'; echo "{$x}"; // works as expected echo "{intval($x)}"; // hoped for "5", got "{intval(05)}"

    Read the article

  • PHP preg_replace - Very quick question

    - by RC
    Masters of regular expressions, please help! See this string: $string = "http://www.url.com/?fieldA=123&fieldB=456&fieldC=789"; Assuming "fieldB" always has a positive non-decimal numerical value (but not necessarily three digits long), what preg_replace command do I need to remove it completely, such that the string will then read: $string = "http://www.url.com/?fieldA=123&fieldC=789"; Thanks!

    Read the article

  • Simple PHP form Validation and the validation symbols

    - by Cool Hand Luke UK
    Hi have some forms that I want to use some basic php validation (regular expressions) on, how do you go about doing it? I have just general text input, usernames, passwords and date to validate. I would also like to know how to check for empty input boxes. I have looked on the interenet for this stuff but I haven't found any good tutorials. Thanks

    Read the article

  • C# How do I replace an actual asterisk character (*) in a Regex expression?

    - by fraXis
    Hello, I have a statement: I have a string such as content = "* test *" I want to search and replace it with so when I am done the string contains this: content = "(*) test (*)" My code is: content = Regex.Replace(content, "*", "(*)"); But this causes an error in C# because it thinks that the * is part of the Regular Expressions Syntax. How can I modify this code so it changes all asterisks in my string to (*) instead without causing a runtime error? Thanks.

    Read the article

  • How do you get the host address and port from a System.Net.EndPoint?

    - by cyclotis04
    I'm using a TcpClient passed to me from a TcpListener, and for the life of me I can't figure out a simple way to get the address and port it's connected to. The best I have so far is _client.Client.RemoteEndPoint.ToString(); which returns a string in the form FFFF::FFFF:FFFF:FFF:FFFF%00:0000. I've managed to extract the address and port using Regular Expressions, but this seems like overkill. What am I missing?

    Read the article

< Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >