Menu
  • HOME
  • TAGS

How to get a number from a class name in jquery?

jquery,regex,match

You just forgot to take a class of the found element instead of the element itself: $('.next-arrow').click(function (){ var num = $(this).closest('[class^=step-]').attr("class").match(/\d+/)[0]; console.log(num); }); ...

Match and replace operation in data frame in R

r,replace,pattern-matching,match,vlookup

Could also do df1[] <- match(unlist(df1), df2$V1) # V1 V2 V3 # 1 1 NA 9 # 2 2 1 NA # 3 3 NA 3 # 4 4 8 4 # 5 5 NA 5 # 6 6 4 3 If the numbers in df2 are not always in...

subset data from matching package

r,match,subset,dplyr

If you just want to keep, say, the first row of treat for each value of ID, then you can use slice: DATA_clean <- treat %>% group_by(ID) %>% slice(1) Your original code didn't work because n() returns to the total number of rows for each value of ID. If every...

How to check if a regex groups are equal?

c#,.net,regex,match

You can use a Dictionary<string, List<string>>: string pattern = @"(?<key>\w+)=(?<value>\w+)"; Regex rgx = new Regex(pattern); MatchCollection matches = rgx.Matches(input); Dictionary<string, List<string>> results = new Dictionary<string, List<string>>(); foreach (Match item in matches) { if (!results.ContainsKey(item.Groups["key"].Value)) { results.Add(item.Groups["key"].Value, new List<string>()); } results[item.Groups["key"].Value].Add(item.Groups["value"].Value); } foreach (var r...

Lua word search

arrays,lua,match,word,lpeg

One thing you could do is make a table of words you want to look for, then use gmatch to iterate each word in the string and check if it's in that table. #!/usr/bin/env lua function matchAny(str, pats) for w in str:gmatch('%S+') do if pats[w] then return true end end...

jQuery - Using indexOf() with match()

jquery,regex,url,match,indexof

related question: Is there a version of JavaScript's String.indexOf() that allows for regular expressions? But only for a case sensitive is more easy to do: window.location.href.toLowerCase().indexOf("youtube.com/thumbnail?id=") ...

Replace the characters in every line of a file, if it match a condition - Unix

unix,replace,sed,match,condition

There is no need to loop through the file with a bash loop. sed alone can handle it: $ sed -r '/^.{14}R.{12}D/s/(.{52}).{4}/\10000/' file 05196220141228R201412241308D201412200055SA1155WE130800001300SL07Y051 05196220141228R201412241308A201412220350SA0731SU1950LAX C00020202020 05196220141228R201412241308D201412200055SA1155WE130800005300SL07Y051 05196220141228N201412241308A201412240007TU0548WE1107MEL C00000000015 07054820141228N201412220850D201412180300TH1400MO085000040300UL180001 This uses the expression sed '/pattern/s/X/Y/' file:...

Regex from a html parsing, how do I grab a specific string?

c#,html,regex,match

I'm trying to specifically get the string after charactername= and before " >.  So, you just need a lookbehind with lookahead and use LINQ to get all the match values into a list: var input = "your input string"; var rx = new Regex(@"(?<=charactername=)[^""]+(?="")"; var res = rx.Matches(input).Cast<Match>().Select(p =>...

Python matching regex multiple times in a row (not the findall way)

python,regex,match

first of all Your regex will work as you expect : >>> s="aa2.jhf.jev.d23.llo." >>> import re >>> re.search(r'([ a-zA-Z0-9]{1,3}\.){2,4}',s).group(0) 'aa2.jhf.jev.d23.' But if you want to match some sub strings like U.S. , c.v.a.b. , a. v. p. you need to put the whole of regex in a capture group :...

Simple Way of Looking for Key Phrases in Jquery?

jquery,key,match,phrases

var keys = ['good', 'yes', 'nice']; for (var i = 0; i < data.msgs.length; i++) { str = data.msgs[i].msg.toLowerCase(); for(var j=0; j < keys.length; j++){ if(str.indexOf(keys[j]) !== -1){ count++; //could also return here if you want to break the function after a find } } } You could also load...

Matching a file with table in postgres and identify the match level

java,postgresql,arraylist,match,multicolumn

Since Postgresql 9.1 you can use foreign data wrappers to view files as tables. http://www.postgresql.org/docs/9.4/static/file-fdw.html Once you can see your Csv as a table, you can use SQL power to generate your report. CREATE TABLE t ( id SERIAL PRIMARY KEY, c1 text, c2 text, c3 text ) ; CREATE...

IF duplicate cell value found in column then return value

excel,if-statement,indexing,match,countif

Here is a User Defined Function (aka UDF) to accomplish the task. Function my_Travels(nm As Range, loc As Range, cal As Range) Dim n As Long, cnt As Long, v As Long, vLOCs As Variant, vTMPs As Variant Dim iLOC As Long, sTMP As String my_Travels = vbNullString '"no travels"...

Use string in match [duplicate]

javascript,regex,match

You need to use RecExp object here: var count = (countDescription.match(new RegExp(u, 'g')) || []).length; Where variable u contains the string you want to match. PS: Make sure u doesn't have any special regex meta characters. Otherwise you will need to escape them....

Matching a pattern with `match()` with extra condition

r,match,condition

This works: fixedTrue <- function(x, y) { toChange <- which(match(x, exact_orig) == match(y, exact_flag)) x[toChange] <- exact_change[match(x[toChange], exact_orig)] } Amended to check positions in flag and orig the same Slightly closer to original: fixedTrue <- function(x, y) { m <- match(x, exact_orig); n <- match(y, exact_flag) x[which(m == n)] <-...

Match Function in Specific Column Excel VBA

excel,vba,excel-vba,match,worksheet-function

What you mean to do is better served with Range.Find. Dim rngtrg As Range, rngsrc As Range Dim ws As Worksheet Set ws = ActiveSheet Set rngsrc = ws.Range(ws.Cells(1,colnumvar),ws.Cells(1000,colnumvar)) Set rngtrg = rngsrc.Find(1,...) rowvar = rngtrg.Row ...

Google Sheets - Array Formula, match, lookup

indexing,google-spreadsheet,match,lookup,array-formulas

In F6: =ArrayFormula(IF(LEN(D6:D),IFERROR(VLOOKUP(D6:D,{E6:E,D6:D},2,0),"No Referrals"),)) and in G6: =ArrayFormula(IF(LEN(D6:D),IFERROR(VLOOKUP(D6:D,FILTER({E6:E,D6:D},(MATCH(E6:E,E6:E,0)+ROW(E6)-1)<ROW(E6:E)),2,0),"No Referrals"),))...

Inconsistent match function, if I run twice works (R)

r,match,matching

From help(match): "match returns a vector of the positions of (first) matches of its first argument in its second." So it looks at each element in names(current_qty) and returns the position of it in trade_order. So for example it sees "ivvb11" in the second position on trade_order. Then this gets...

'NoneType' object has no attribute 'group' in a list

python,python-2.7,match

Its because of that your regex engine doesn't found a match so it returns None and you tried to get its group. For get ride of that you can use a try-except : handshake = piece_request_handshake.findall(hex_data) match = piece_request_handshake.match(hex_data) try : info_hash = match.group('info_hash') # If the packet is a...

Excel Logical Function to Concatinate

excel,function,search,find,match

It was possible to overcome this issue by using the FIND function, but changing the logical test to check for an error in the find results. Where you look for a value which is not present, the FIND function will generate a "#VALUE!" error. Simply nest the FIND function into...

find matches in two file using python

python,match

I would recommend using pandas merge function. However, it requires a clear separator between the 'Gene' and 'function'-column. In my example, I assume it is at tab: import pandas as pd #open files as pandas datasets file1 = pd.read_csv(filepath1, sep = '\t') file2 = pd.read_csv(filepath2, sep = '\t') #merge files...

Index & Match formula does not show the repeated entry with different value

excel,indexing,excel-formula,match

As @houssam said, you can try this one in S3: =IFERROR(INDEX($C$3:$C$22,$N3,COLUMNS($R$3:R3)),"") does this help?...

php matching array names to another array's values

php,arrays,order,match

So here is it mostly working, the part I don't understand is how you determine the duplicate, as when you set $fruit[2]='bag'; and then set $fruit[2]='crunchy'; it will actually be overwritten so it will be as if $fruit[2]='bag'; was never executed to begin with sample code $header[0]= 'apple'; $header[1]='banana'; $header[3]='grape';...

INDEX MATCH multiple criteria not working (#N/A)

excel,indexing,match,lookup

Your sample data shows that a number has been split off a text string without converting it back to a true number. In short, a cell containing ="99" is not equal to a cell containing the number 99 even though COUNTIF or COUNTIFS function will say it does. Put a...

Regex with lookahead and lookbehind

php,regex,match

You can use: preg_match_all('/(?<={{)item:[^}]*(?=}})/', $str, $matches); print_r($matches[0]); Array ( [0] => item:id [1] => item:first_name ) ...

Cypher - atomic insert if node is absent

neo4j,match,case,cypher

You can actually use the MERGE statement instead of trying to interrogate whether the node is there first. This statement will create the nodes and relationships if it does not already exist and won't create it if it is already there. MERGE (b:B {id:123} )<-[:REL]-(:A) return * ...

Regex closest text matching [duplicate]

regex,match,group,closest

Greedy vs Lazy By default a RegExp quantifier, (+, *, {}). Are greedy. That means they will get as many as they can. Use a ? to make if lazy. Updated: (foo)([\s\S]+?)(doo|some) RegEx101 Alternatives Click on RegExp for Demo (foo)\s*([\S]+?)\s*(doo|some) Will cause white-space to not be selected (foo\s*[\S]+?\s*(?:doo|some)) Will select...

Compare two files and append the values, leave the mismatches as such in the output file

awk,compare,match,mismatch

This awk script will work NR == FNR { a[$1] = $0 next } $1 in a { split(a[$1], b) print $1, (b[2] == $2 ? $2 : b[2]), (b[3] == $3 ? $3 : b[3]) } !($1 in a) If you save this as a.awk and run awk -f...

how to check in javascript if is string in 100 000,00 format

javascript,string,numbers,format,match

You need to call the method test on the regex, not match on the string. expect(reg.test(text)).toBe(true); .match() with a regular expression returns null...

excel count/sum stop count/sum match?

excel,count,sum,match,sumifs

The INDEX function can provide a valid cell reference to stop using a MATCH function to find an exact match on 0. This formula is a bit of a guess as there was no sample data to reference but I believe I have understood your parameters. =SUMIFS(C2:index(C2:C35, match(0, A2:A35, 0)),...

Partial string merge R large dataset

r,merge,match

Here's a shot: Use first three letters of first name and full last name as matching criteria: df1$xsub= gsub("^([^,]+)\\, (.{3})(.+)", "\\2 \\1", tolower(df1$x) ) df2$ysub= gsub("^(.{3})([^ ]+) (.+)", "\\1 \\3", tolower(df2$y) ) merge(df1,df2, by.x="xsub", by.y="ysub") #---------------- xsub x p y c 1 kat jameson JAMESON, KATHERINE 200 Kathy Jameson Facebook...

javascript match method with a closing square bracket character

javascript,regex,match

"Acb]".match(/[\(, \), \[, \]]/) returns ["]"]. You should use / instead of a quotation mark to denote a regex to avoid problems with escaping You also dont need to escape most of those characters. "Acb]".match(/[()[, \]]/) will match (, ), [, ], a comma, or a space Info on character...

Regular expression, match error

regex,replace,match

You can dispense with most of your pattern - much of it is unnecessary. Try this: <img.*?> With the unnecessary brackets removed, the important change is adding ? to make it a reluctant quantifier - one that matches as little as possible....

Updating only certain values of data frame based on match

r,match,lapply

Update for your Toy Example You need to subset both sides of your assignment, and also convert your conditions to logical subsetting vectors. logical1 <- !is.na(test1[match(test$A, test1$A),2]) # TRUE/FALSE logical2 <- !is.na(test1[match(test$A, test2$A),2]) test[t1,] <- test1[t1,] # selects only TRUE rows test[t2,] <- test2[t2,] I recommend you look at each...

Matches in a string in Java

java,string,variables,match

String string = "40' & 40' HC"; if(string.contains("&")) System.out.println("Found"); replace .matches with .contains, i believe you are trying to check for a character in the string....

How to use a set of characters in the javascript match method

javascript,regex,match

Put the characters in a set, so that the regular expression match a character in the string that is any of the characters in the set. The - and ] characters needs to be escaped when used in the set, and the / character needs to be escaped if you...

using the 'Match' function in Exel to return a cell address

excel,reference,match,cell,formula

To make CELL work you need a cell reference, e.g. CELL("address",C1) The trouble is that MATCH just gives you a number, not a cell reference. Probably the easiest way is to use the ADDRESS function, so a first try might be =ADDRESS(1,MATCH(AU14,C1:AG1,0)+2) That would give you the right answer if...

Matching vector of default values using match.arg() with or without error [R]

r,function,arguments,match,evaluation

If choices and args are the same in match.arg, then the first element is returned. Otherwise arg has to be length 1. From match.arg: Since default argument matching will set arg to choices, this is allowed as an exception to the ‘length one unless several.ok is TRUE’ rule, and returns...

Filter information in two columns

excel,excel-formula,match,worksheet-function,input-filtering

With data like: In D1 enter: =IF(ISERROR(MATCH(A1,B:B,0)),1,"") and copy down and then in C1 enter: =IFERROR(INDEX(A:A,MATCH(ROW(),D:D,0)),"") and copy down. This results in: ...

Excel VBA code for multiple vlookup

excel,vba,excel-vba,match,vlookup

In fact, you never ReDim your Result() so it is just an empty array with no actual cell (not even an empty cell), you first need to ReDim it. Here is my version, I didn't use the function Match but that should work anyway : Function Conduitt(ManHole As String) As...

How to return all opposite pairs in a Pandas DataFrame?

python,pandas,match,dataframes

Well, I thought this would take fewer lines (and probably can) but this does work. First just create a couple of new columns to simplify the later syntax: >>> df1['abs_a'] = np.abs( df1['a'] ) >>> df1['ones'] = 1 Then the main thing you need is to do some counting. For...

How to swap the lines in a file that match a condition using Shell script

unix,match,condition,swap,lines

Here is a simple Python script which implements what I think you are trying to describe. from sys import stdin keep = "A" kept = [] for line in stdin: line = line.rstrip("\r\n") pattern = line[27:28] # print("## keep %s, pattern %s, %s" % (keep, pattern, line)) if pattern !=...

Replace string dynamically

php,regex,string,match

If a regex is the only means you have at hand, you can match \bclass="[^"]*"\s* The, replace with an empty string. \b makes sure we are matching class, not subclass. With [^"]*, we can match 0 or more characters other than ". With \s*, we can trim the string automatically....

Each HTML div Requires item

jquery,match,each

/{(.*)}/gi In your regular expression, the * quantifier is "greedy" by default. This means it will try to capture as much as possible. Because of that, you're getting broader matches than you're expecting. One solution is to make your * operator "lazy" by adding a ?: /{(.*?)}/gi A better solution...

What could this expression in Excel mean

regex,excel,indexing,match,vlookup

This formula works only as an array formula. The MATCH part gets the position of that value in lookup!$L$5:$L$105 which is nearest to the value in data!E2. The INDEX part then gets the corresponding value in *range used*. In words of the formula: It matches that value in the array...

Subtract List B from List A, but keeping the List A index and using difflib string similarity

python,string,match,subtract,difflib

How about this: from difflib import SequenceMatcher max_ratio = 0.9 c = [i for i, v in enumerate(a) if not any(map(lambda x: SequenceMatcher(None, v, x).ratio()>=max_ratio, b))] Snippet which used fuzzywuzzy: from fuzzywuzzy import fuzz max_ratio = 90 c = [i for i, v in enumerate(a) if not any(map(lambda x: fuzz.ratio(v,...

Java Regex for HTML status code when checking entire multiline HTML header

java,regex,match,multiline

The . may not match line breaks. Try using (.|\\s)+ instead to also match whitespace characters: ^(HTTP|http)/(1|2)\\.\\d \\d{3}(.|\\s)+$ Based on your edited question, the problem is that the concatenated strings should be placed in parentheses, otherwise the matches method is called against the last string part: System.out.println( ("HTTP/1.1 206 Partial...

Use Python/Pandas to Match Sample Pairs Yearly Data

python,pandas,match,time-series,multi-index

This method is a little messy, but I am trying to make it more robust to account for missing data. First, we'll remove duplicates in the data and then convert the dates to Pandas Timestamps: df = df.drop_duplicates() df.SampleDate = [pd.Timestamp(ts) for ts in df.SampleDate] Then let's arrange you DataFrame...

R: Matching by row and column

r,match,rows

We create a row/column index ('indx1') after subsetting the second dataset ('df2' i.e. 'HistoricalFX'), assign the 'Opening' and 'Closing' columns in the first dataset ('df1' i.e. 'EquityData') with the values that we got from using 'indx1' in 'op1' and 'cl1' op1 <- df2[-1][c(TRUE, FALSE)] cl1 <- df2[-1][c(FALSE, TRUE)] names(cl1) <-...

Regex: capturing groups within capture groups

regex,substring,match,capture-group

This is usually the case where mostly the same data is to be captured. The only difference is in form. There is a regex construct for that called Branch Reset. Its offered on most Perl compatible engine's. Not Java nor Dot Net. It mostly just saves regex resources and makes...

Cross check files in two folders

vbscript,match,filenames

It's rather unsurprising that you don't know what went wrong when you tell your script to shut up about whatever's going wrong (On Error Resume Next). Remove that line (using global OERN is a terrible practice anyway) and see what error you get. Most likely the error is "permission denied",...

r match filenames in two folders and perform code

r,file,directory,match

I think you have you two distinct questions here, really. Find matching list items Execute some operations on a series of files without a for-loop The first thing is pretty simple. Here's a reproducible example, but you could use two lists of filenames from calls to list.files or anything here...

Perl: matching data in two files

perl,match

Here's one way using split() hackery: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my $f1 = 'file1.txt'; my $f2 = 'file2.txt'; my @pdb; open my $pdb_file, '<', $f2 or die "Can't open the PDB file $f2: $!"; while (my $line = <$pdb_file>){ chomp $line; push @pdb, $line; } close $pdb_file;...

case insensitive preg replace on special chars/Umlaute

php,preg-replace,match,case-insensitive

You additionally need to pass the u option for utf8 support. This will work: echo preg_replace("/üöÄ/iu","<b>FOUND</b>","ÜÖÄ"); You can find the list of available options here: http://php.net/manual/en/reference.pcre.pattern.modifiers.php...

Using JS .match() to extract number from string, then use the result to test equality

javascript,regex,match

match returns an array. To compare matched value use: var b = (test1.match(/\d+/)[0] === test2.match(/\d+/)[0]); //=> true Check this Q&A on how to compare arrays in avascript...

Lookup in another, dynamically generated, spreadsheet

excel,indexing,excel-formula,match,vlookup

Try: =VLOOKUP(A36,autospreadsheet!E:I,5,0) ...

Javascript match dont include

javascript,regex,match

Here is an example: http://jsfiddle.net/zgdksaax/ var pattern = /<row>([\s\S]*?)<\/row>/gm; var string = "<row>1</row><row>2</row>"; console.log(string.replace(pattern, "$1").split("")) // ["1", "2"] ...

How to match a word using a given character only once

c#,regex,match

"library" is confusing because it has 2 litters r. But it is solvable from my opinion. Easily Create a map<char, int> this will store the count of each character in the pattern. Then we will generate a map<char, int> for word to check, it will also contain the count of...

match lists L1 with L2 in prolog

list,prolog,match

what am I doing wrong? just a typo, you mispelled the variable H as E: one_occurence([],[]). one_occurence([H|T],[H|TU]) :- delete(T,H,TN), one_occurence(TN,TU). SWI-Prolog compiler will warn you about such problems......

Array Of Objects Help! Compare Student Name with Test Name and assign score

c#,arrays,object,search,match

You can simplify the code using Linq using System.Linq; ... ... static void Main(string[] args) { List<Student> students = new List<Student>() { new Student("Finn", 0), new Student("AJ", 0), new Student("Sami", 0), new Student("John", 0), new Student("Rey", 0) }; List<Test> tests = new List<Test>() { new Test("Finn", 100), new Test("AJ", 97),...

neo4j cypher count relations between same type of nodes

count,neo4j,match,cypher

The solution I propose has the following logic : Find the user 1 Find other users that are not user 1 Find an OPTIONAL MATCH for a path between user1, a drink and the current iteration of the other user This is based on the following test graph : http://console.neo4j.org/r/xc3cqt...

match subdocument within another subdocument same document

mongodb,match,project,subdocument

Your aggregation missed some thing you should matched in project to macthed roles.id == usuarios.roles.id check below aggregation : db.collectionName.aggregate({ "$unwind": "$usuarios" }, { "$match": { "usuarios.id": ObjectId("556ca1de9487009c1fac1262") } }, { "$unwind": "$usuarios.roles" }, { "$unwind": "$roles" }, { "$project": { "nombre": 1, "roles": 1, "usuarios.id": 1, "usuarios.activo": 1, "usuarios.roles.id":...

VBA lookup for approximate value

vba,match,condition,criteria,vlookup

This should work (I decided not to use worksheetfunction.vlookup): Sub MyVlookup2() Dim myrange As Range Dim i As Long, j As Long Dim lastrow As Long Dim lastrow2 As Long Dim diff As Double Const tolerance As Long = 100 Set myrange = Range("D:G") lastrow = Sheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Row lastrow2...

Ruby Regex Replace Last Occurence of Grouping

ruby,regex,match,gsub

If I correctly understood, you are interested in gsub with codeblock: str.gsub(PATTERN) { |mtch| puts mtch # the whole match puts $~[3] # the third group mtch.gsub($~[3], 'NEW') # the result } 'abc'.gsub(/(b)(c)/) { |m| m.gsub($~[2], 'd') } #⇒ "abd" Probably you should handle the case when there are no...

Regular expression in JavaScript to match turkish characters

javascript,regex,match

Just remove the flag g. var kelime = /#(\w+)/i; console.log( kelime.test('#bursa') ); console.log( kelime.test('#büşra') ); The "g" flag indicates that the regular expression should be tested against all possible matches in a string. It means that after the first match, it will save a "cursor" where it has found it....

Strange behavior of match function in R

r,match

I found that one possible solution is to use pmatch ("Partial String Matching"), although the functions first converts to a character vector with as.character. I'm sure there must be situations where this would cause problems, but it works for this case: pmatch(a,b) #[1] 11 12 13 14 15 16 17...

Why is match returning the whole string as the first element in the array?

javascript,regex,match

Zeroth element is always the full match. First element is the first capture, second element is the second capture, etc. If you just want all the captures without the full match, you can use result.slice(1). If you are asking "Why is the first element the full match?": It's just the...

Finding closest value if date is equal to a certain date

excel,if-statement,indexing,excel-formula,match

Yours won't work because you need to perform the IF condition before you search for your value. If you are looking to do this without any additional columns (as your attempt does), a more correct formula would be: =INDEX($K$2:$K$25;MATCH(MIN(IF($C$2:$C$25=$T$9;ABS($K$2:$K$25-100);1000));IF($C$2:$C$25=$T$9;ABS($K$2:$K$25-100);1001);0)) Make sure to enter this with CTRL + SHIFT + ENTER...

Sub-setting / Matching row and columns in R

r,matrix,match,subsetting

This kind of magic is called matrix indexing. If you had rows and cols be the ones you didn't want, or if matrix indexing allowed for negative values, it would be even easier. y <- matrix(0, nrow=5, ncol=2) y[cbind(rows,cols)] <- x[cbind(rows,cols)] y ## [,1] [,2] ## [1,] 65 345 ##...

Android Key Hash - Users appearing to have different keys

android,facebook,hash,key,match

The problem was identified as Kindle only users. We then found it only occurred when the Facebook app was installed. We recently updated to the GoViral ANE for Facebook Login, but hadn't released a new Kindle build until recently, which broke the Login for those users with the Facebook app...

Regex match defined length number broken up by spaces/hyphens

regex,match

Have a try with: ^(?:-?[a-zA-Z0-9]){4,34}-?$ ...

can match() have a range included in R?

r,match

In that case, I would use subsetting: v[v>2.2 & v<2.6] or which(v>2.2 & v<2.6) depending on if you want the values or the index...

Making ArrayList Size equal to other Array Lists Available in Java

java,loops,arraylist,match,add

Since i is never equal to Array1.size(), this loop never adds anything for (int i = Array2.size(); i == Array1.size(); i++) { Array2.add(i, "Test"); } ...

Why python regex match function matches that special character? [closed]

python,regex,match,special-characters

You regex should be: re.match('^[a-zA-Z0-9]+$', "coun[ter") not re.match('^[a-zA-z0-9]+$', "coun[ter") When you have A-z it captures everything from A (ASCII 65) to z (122) and that also matches [ (91)....

Two Column Lookup

excel,match,vlookup

In your match expression, you are comparing one concatenated value $J$1&C3 to another single concatenated value '2006 Results'!$A$2&$B$556. Match expects that second parameter to be a range rather than a single value. In cases like this, where multiple criteria are required, I prefer to use sumifs rather than index-match, even...

Match and index all substrings, including overlapping ones

python,regex,indexing,match,overlapping-matches

Using re.finditer, you can obtain start locations: import re seq = "blahblahblahLALALAblahblahLALA" substring="LALA" lenss=len(substring) overlapsearch="(?=(\\"+substring+"))" xx=[[x.start(),x.start()+lenss] for x in list(re.finditer(overlapsearch,seq))] check=[seq[x[0]:x[1]] for x in xx] print xx print check Results: [[12, 16], [14, 18], [26, 30]] ['LALA', 'LALA', 'LALA'] And results using your original example: [[9, 17], [24, 32]] ['GTTTGCAG',...

How do I apply a formula to a range without applying said formula to every cell?

regex,string,google-spreadsheet,match,array-formulas

I think what you want may be array_constrain but for your example I can only at present offer you two formulae (one for each side of the comma): =Array_constrain(arrayformula(left(E2:E,find(",",E2:E)-1)),match("xxx",E:E)-1,1) =Array_constrain(arrayformula(mid(E2:E,find(",",E2:E)+1,len(E2:E))),match("xxx",E:E)-1,1) ...

Excel MATCH statement nested in INDIRECT statement?

excel,nested,match

As you wrote, function 1 returns the actual value of cell A16. If you nest func 1 in func 2, Excel would resolve this into: =INDIRECT(J3 & "!" & Function1) =INDIRECT(J3 & "!" & INDIRECT("A" & MATCH(A16, Sheet1!A:A, 1))) =INDIRECT("Sheet2!My value in A16") Obviously, this leads to an error. To...

Matching two things with string in between

php,regex,match

I assume that your input formats are exactly like above. {{for\s+\K[^\s}]+(?=\s+in\s+[^\s}]+}})|[^\s}]+(?=}}) \K keeps the text matched so far out of the overall regex match. (?=...) called positive lookahead assertion. DEMO...

How to select elements from previous div that have the same position inside parent

javascript,jquery,html,css,match

You can use: $('li.user' ).hover(function(){ $('li.user-text:eq('+$(this).index()+')').show().siblings().hide(); }); Working Demo...

Regex for comparison expression

c#,regex,match

A regex like ^\(\s*[a-zA-Z0-9_+\-\/* ]+\s*(>=|<=|>|<|==|!=)\s*[a-zA-Z0-9_+\-\/* ]+\s*\)$ should do the trick, right? A Regex101 with it in action can be found here....

Conditional VLOOKUP or INDEX MATCH

excel,match,vlookup

This will have to be an array formula for a two column match. =INDEX('Data Table'!R:R; MATCH(1; ('Data Table'!C:C=C27)*('Data Table'!AB:AB=""); 0); 1) Array formulas need to be finalized with Ctrl+Shift+Enter↵. Try and reduce your full-column references to ranges more closely representing the extents of your actual data. Array formulas chew up...

Issue with Arrays/Match/Index

arrays,excel,if-statement,excel-formula,match

This should be as simple as multiplying in another condition that returns 1/0. You will get a 0 unless both conditions are met. {=LARGE( IF(Table_owssvr_1[HQ Name]=B1,1,0)* IF(Table_owssvr_1[Status]="Live -3",1,0)* IF(ISNUMBER(Table_owssvr_1[Live Date]),Table_owssvr_1[Live Date],0), 1)} ...

Perform partial search on MySQL table when exact match may be available

php,mysql,select,match

You could use an order by to ensure the exact match is always on top: ORDER BY CASE WHEN PHONE = :phone THEN 1 ELSE 2 END ...

CSS Target Attribute Containing Partial Match

html,css,match,selector,partial

Try this a[href*="checkout"] { /* Do something. */ } You have to use *, which means contain - see reference. Also, don't forget to close anchor tags </a> Working JSFiddle...

Extract variables from pattern matching

vb.net,design-patterns,match,extraction

^\d*(?<City>[A-Z a-z0-9]*)\s*\{(?<Titles>[A-Z a-z0-9]*)\}.*?\{(?<Cool>.*?)\}$ Seems to match your sample input. Expresso is a great tool for designing regular expressions....

query for two tables and have one column populate based on first match

sql-server,join,header,match

You have no predicate joining dbo.patient so are therefore getting a cross join (Cartesian Product): from [exportb].[dbo].[LEDGER],exportb.dbo.patient This should be: FROM dbo.Ledger INNER JOIN dbo.Patient ON Patient.rpid = Ledger.rpid You also never reference the table aliased as LEDGE anywhere apart from the join, so you may as well remove this...

MySQL: Remove JOIN for Matched Row if 2nd Round of Criteria Not Met

mysql,join,left-join,match

Your first query: SELECT *, @MidMatch := IF(LEFT(l.middle,1)=LEFT(d.middle,1),"TRUE","FALSE") MidMatch, @AddressMatch := IF(left(l.address,5)=left(d.address,5),"TRUE","FALSE") AddressMatch, @PhoneMatch := IF(right(l.phone,4)=right(d.phone,4),"TRUE","FALSE") PhoneMatch, @Points := IF(@MidMatch = "TRUE",4,0) + IF(@AddressMatch = "TRUE",3,0) + IF(@PhoneMatch = "TRUE",1,0) Points FROM list l LEFT JOIN database d on IF(@Points <> 0,(l.first = d.first AND l.last = d.last),(l.first = d.first...

Unix Pattern Matching

unix,character,match

nvm, was overthinking it. using ls -1 *"file"? solved my problem! XP

Matching first letter of word

regex,perl,match

That regex doesn't do what you think it does: m/^d(\w)/ Matches 'start of line' - letter d then a single word character. You may want: m/^\d+(\w)/ Which will then match one or more digits from the start of line, and grab the first word character after that. E.g.: my $string...

OpenCV - C++ to Java - Template Match

java,c++,templates,opencv,match

As cyriel said, You forgot to fill zeros for the maximum location and hence you got the infinite loop. May be he forgot to explain you that, for each iteration find the max location check if max value is greater than desired threshold if true show me what is max...

AUTOHOTKEY: RegExMatch() a series of numbers and letters

regex,match,autohotkey

You had to many ( ) This is the correct implementation: test := RegExMatch("1234AB123","[0-9]{4,4}([A-Z]{2})[0-9]{1,3}") Edit: So what I noticed is you want this pattern to match, but you aren't really telling it much. Here's what I was able to come up with that matches what you asked for, it's probably...