match

please help me understand the pattern match in haskell. i'm a little confused.

if i have somthing like that: func (x1:x2:x3:xs) = xs then x1,x2,x3 must exist, yes? they can't be [], but must(again, MUST) be with a value, yes? also, the xs can be [] or [a] or [a,a,a] (etc'), yes? (in [a] i mean that it's a list with one number, and [a,a,a] is list of three numbers). also i have function that define isPrefixOf: m...

Call a function if a variable contains any items in an array?

How can i call a javascript function if a string contains any of the items in an array()? Yes, i can use jquery :) ...

Extracting numbers from the parent attribute in jQuery

By clicking on the "mylink" I want the link to be replaced by the number "123", which is extracted from parent tag. I think I'm not doing the ".match(...." right. jQuery: $(document).ready(function(){ $(".link").click(function(){ var comid = $(this).parents("div.comment").attr("class").match(/comment-([0-9]+)/)[1]; $(".link")...

Display posts from x cat and y tag

Is it possible to fetch posts matching categorie x "AND" tag y? Read the docs, it seems you can do: query_posts('tag=bread,baking'); or query_posts('cat=2,6,17,38'); ... is it possible to use both cat and tag simultaneously? ...

Find if the element contains x but not y (jQuery)

<div> <p><a href="#">link</a> some text</p> <p><a href="#">link</a></p> <p><a href="#">link</a> some text</p> <p><a href="#">link</a></p> </div> I want to find (and addClass to) the <p> tags that DO NOT contain text, directly inside itself or its children. ...

Grab the youtube Video ID with Jquery & .match()

Just need a little push as I have this almost working. I want to feed jquery a URL and have it strip everthing but the video url. Here is my code: var url = 'http://www.youtube.com/watch?v=bxp8NWvIeSo'; $results = url.match("[\\?&]v=([^&#]*)"); alert($results); }); I'm getting this as an output - ?v=bxp8NWvIeSo,bxp8NWvIeS...

Case Insensitive Pattern Matching over String Lists

I'm trying to parse command line arguments in an F# application. I'm using pattern matching over parameters list to accomplish it. Something like: let rec parseCmdLnArgs = function | [] -> { OutputFile = None ; OtherParam = None } | "/out" :: fileName :: rest -> let parsedRest = parseCmdLnArgs rest ...

Matching arrays in php

I need check whether a given array will match another array. I can't figure out how to either manipulate the first array, or to match it some other way. I need to match this array: Array ( [1] => site [2] => blog [3] => index.php ) to match this: Array ( [site] => Array ( [path] => site ...

Simple regex url-related matching help

Hi, Take the following URI: http:\/\/.*\.google\.com/search/results\.php* I am simply trying to match all single forward slashes ( / ) between two alphanumeric characters in a given URI. In the case above, the two just before search and results. Could you point me in the right direction? EDIT The intention is to do search and repla...

MySQL question, unexpected behaviour 'in boolean mode'

I use the following call for getting information from a database: select * from submissions where match( description ) against ('+snowboard' in boolean mode ) and (!disabled or disabled='n') order by datelisted desc limit 30 Which means everything with ‘snowboard' in the description is found. Now here’s the problem: select ...

Matching expression inside of a data section of an xml element using xsl

Hi I am usually programming in c++ so XML/XSL/XPATH is not my strong side, but I need to do a transformation and I cannot seem to find a good way of doing it. We have an xml file that is formatted like this: <outer> <element/> <other_element/> <message pri="info"> [[!CDATA Error: something is not working]] </message> <me...

Return positions of a regex match() in Javascript?

Is there a way to retrieve the (starting) character positions inside a string of the results of a regex match() in Javascript? ...

select numbers and insert to database ??

I have a html file that has invoice details I would like to know is there a way that I can retrieve only the invoice numbers and store it separately in my sql database using php? <p>Invoice ID: 0201</p> <p>MID : Q987</p> <p>Desciption: Solid Concrete Blocks</p> <p>Qty: 7478 Blocks </p> <p>&nbsp;</p> <p>Invoice ID: 0324</p> <p>MID : Q44...

Data clean up: are there libraries of common permutations that we can use? Or is there a better approach?

We are working on clean-up and analysis of a lot of human-entered customer data. We need to decide programmatically whether 2 addresses (for example) are the same, even though the data was entered with slight variations. Right now we run each address through fairly simplistic string replacement (replacing avenue with ave, for example)...

mysql match against russain

Hey, Trying to solve this for a very long time now... SELECT MATCH(name) AGAINST('абраксас') (russian) doesn't work, but SELECT MATCH(name) AGAINST('abraxas') (english) work perfectly. I know it's something with character-set, but I tried all kind of settings and it didn't work. For now it's latin-1. LIKE works This is the show v...

Match returning a string instead of object

This simple regex matching returns a string instead of an object on every browser but the latest firefox... text = "language. Filename: My Old School Yard.avi. File description: File size: 701.54 MB. View on Megavideo. Enter this, here:" name = text.match(/(Filename:)(.*) File /); alert(typeof(name)); as far as i know ...

What Algorithm will Find New Longtail Keywords for *keyword* in PPC

I am looking for the algorithm (or combo) that would allow someone to find new longtail PPC search phrases based on say one corekeyword. Eg #1 word word corekeyword eg #2 word corekeyword word Google search tool allows a limited number vertically - mostly of eg#1 (https://adwords.google.com.au/select/KeywordToolExternal) I also know ...

JS/Jquery, Match not finding the PNG = match('/gif|jpg|jpeg|png/')

I have the following code which I use to match fancybox possible elements: $('a.grouped_elements').each(function(){ var elem = $(this); // Convert everything to lower case to match smart if(elem.attr('href').toLowerCase().match('/gif|jpg|jpeg|png/') != null) { elem.fancybox(); } }); It works great with JPGs but...

What is fastest way to find number of matches between arrays?

Currently, I am testing every integer element against each other to find which ones match. The arrays do not contain duplicates within their own set. Also, the arrays are not always equal lengths. Are there any tricks to speed this up? I am doing this thousands of times, so it's starting to become a bottle neck in my program, which is ...

Java: method to get position of a match in a String?

String match = "hello"; String text = "0123456789hello0123456789"; int position = getPosition(match, text); // should be 10, is there such a method? ...