Questions tagged [match]

1

votes
1

answer
204

Views

Use of moved value when matching on a value that implements Into<String>

I want a function which accepts both &str and String. The only way I know to do this is by using Into. However, inside the function, I'm trying to match the Into. This causes some issues, as the arm is a &str. This is what I have (stripped down): struct Location { language: String, } fn new(language...
jhpratt
1

votes
2

answer
44

Views

PHP replace image src and add a new attribute in image tag from a string containing different html tags [duplicate]

This question already has an answer here: How do you parse and process HTML/XML in PHP? 30 answers I have a site where i get products description from database and decode html like this in PHP and display it on webpage frontend: $data['description'] = html_entity_decode($product_info['description']...
Haroon
1

votes
2

answer
45

Views

How to put a character as end of expression

I have this regular expression url\s*\((?:\'|'|)((\S*|\?)(?
Bruno Andrade
1

votes
1

answer
34

Views

PHP preg_match_all - what's wrong with this regex? [duplicate]

This question already has an answer here: What do 'lazy' and 'greedy' mean in the context of regular expressions? 11 answers What is the difference between .*? and .* regular expressions? 3 answers Regex question mark 4 answers Suppose I have the following in a text file: xxa name='round_xx Numbe...
Callum
1

votes
2

answer
8.8k

Views

Regex value from input field

I have a $html variable containing a lot of html code and I'm trying to extract the value from a certain parameter (this can be the value, or the class, etc.) out of an input field based on its id. An example of the code I'm trying to find: I'm trying to build a regex that extracts the value (fname....
Davor
2

votes
2

answer
27

Views

i need to find the first negative number in each column of a matrix

Hello i need to find the position of first negative number for each row vector in a matrix i've tried with match and apply but it ony shows the first z
Matteo Esposito
1

votes
2

answer
58

Views

In Powershell -match, can $Matches be reused?

I'm attempting to read multiple values from a string. The keywords may appear anywhere in the string. I want the 'Value' or content directly following it. $str = 'Some version v1.2.3.4 (xyz) AnotherVal RandomKeyword: ValX' I've tried $test = $str -match 'Some version .*' $val1 = $Matches[0] -repla...
nimchimpsky
1

votes
2

answer
69

Views

SOLVED: How to create UDF for multi-variable Index Match formula

I want to create a UDF for the following Excel index-match formula: {=INDEX($A$1:$J$7,MATCH(B9,$A$1:$A$7,0),MATCH(1,($A$1:$J$1=B10)*($A$2:$J$2=B11),0))} enter image description here AA AA AA BB BB BB CC CC CC a b c a b c a b c 1 10 55 24 48 95 19 5 28 65 2 16 48...
SteveC
1

votes
3

answer
275

Views

Regex modification - matching optionally dash (PHP)

I would like to ask you how to modify that regex: '/\b([A-Z]{2,}[0-9][0-9A-Z-\/]*)/is' as currently it can only match it if there would be not '-'. What I am trying to achieve is that in addition it can match something like that i.e. TGW-1234 so at least 2 letters followed by (optionally) dash a...
Marcin
1

votes
5

answer
215

Views

Regex to match specific string not enclosed by another, different specific string

I need a regex to match a string not enclosed by another different, specific string. For instance, in the following situation it would split the content into two groups: 1) The content before the second {Switch} and 2) The content after the second {Switch}. It wouldn't match the first {Switch} becau...
joshholat
1

votes
2

answer
35

Views

Having trouble with less than(<) operator in php preg_match_all

I'm trying to parse a query string and have run into something I can't quite figure out. Trying to match a string that can contain either < or >, but I'm seeing some weird output only when the string contains a Returns as expected: Array ( [0] => Array ( [0] => wt>f ) [1] => Array ( [0] => wt>f )...
Knut L
1

votes
0

answer
69

Views

Match Columns in different sheets and Update column in Excel

I have an Excel Workbook in which I've got a DataEntry sheet and lot of other sheets. What I have to do is on basis of columns (at least 2) matching between DataEntry sheet and Sheet1, I want to pick value of the third column of DataEntry sheet and insert it in matching a row of Sheet1 in the corres...
Malikx
1

votes
3

answer
263

Views

Partial match of strings [closed]

I would like to find a way to do a partial match of strings. I have two 50-bit binary inputs. If any input is matched with data at least 5-bit in database (array), I would print the input. Let's say my input is like this. X is a 'don't care' bit; it would be changed to ., 11XX110010001011011111011...
Jaeyoung Park
1

votes
1

answer
60

Views

R: assign value based on criteria

I am trying to convert test scores from a psychological questionnaire in the first data set to standardized scores (range of percentiles) in another data set The test scores are one score from 9 people that took my questionnaire TestResults
Laura
1

votes
1

answer
62

Views

Append pandas dataframe with column of averaged values from string matches in another dataframe

Right now I have two dataframes (let's call them A and B) built from Excel imports. Both have different dimensions as well as some empty/NaN cells. Let's say A is data for individual model numbers and B is a set of order information. For every row (unique item) in A, I want to search B for the (poss...
Sean Kelso
1

votes
1

answer
64

Views

Remove all the unnecessary characters from a string of English words and Chinese characters

Is there any preg_replace function (or any other method) to remove all the unnecessary characters from a string of English words and Chinese characters. Unnecessary characters include all the special characters (including underscores), and numbers. Please note that I do not want spaces to get remove...
Harish Jhaldiyal
1

votes
0

answer
98

Views

google-diff-match-patch - wrong word diff

I have 2 words '50g' and '75g' and using DiffMatchPatch showing that '5' and 'g' is identical. Its suppose only 'g' is identical. This url you can test above words and it show the same result. https://neil.fraser.name/software/diff_match_patch/demos/diff.html Is it bug or i just had a wrong interpre...
Sh4m
1

votes
1

answer
84

Views

How to match a string after a specific string using RegEx (C#)

Here's a sequence: blue Water red Apple yellow Sun I would like to use RegEx to find the first occurence of after the string red. I tried (?
Phil Zan
1

votes
0

answer
281

Views

Code Signing Error with fastlane

I am getting error while building my application through fastlane. It gives me error that Code Signing Error: No profile for team '4TM2DK894Y' matching 'match Development bundle-id' found: Xcode couldn't find any provisioning profiles matching '4TM2DK894Y/match Development bundle-id'. I was able t...
Umair Aamir
1

votes
0

answer
90

Views

Similar String Matching Algorithm : Jaccard, Dice ,Cosine and Exact

I am trying to find out the similarity between two english sentences. Among Jaccard, Dice, Exact and Cosine string matching algorithm which is the best when it comes to string matching or determining the closeness? Sentence 1: Online shopping for electronics, computer parts, apple accessories, healt...
Anas Shahid
1

votes
0

answer
52

Views

How to group similar rows in dataset?

I am trying to think of a good way to combine several datasets where each dataset has a slightly different set of information on the same set of items, and therefore includes slightly different data. For example: +----+------+--------+-------+------------------+----------+---------+---------+ | h |...
matmaxgeds
1

votes
1

answer
45

Views

R- vector argument matching and perform corresponding calculation

Let's say I want to create a function that takes arguments of value x, y, and type, like myfun
Helen
0

votes
1

answer
17

Views

PHP </br> where lower-case letters meets uppercase-letter

I am trying to put before every character which meets with a uppercase-letter. What I achieved is: $str = 'Rating: goodHelps control sebum production Rating: averagePrevents the development of microorganisms in cosmetics Rating: badCan be allergenic Rating: badToxic to cell division'; $string = p...
Alper Köse
1

votes
1

answer
82

Views

Regex to match only repeating group (laughing expressions) [duplicate]

This question already has an answer here: How can I detect laughing words in a string? 3 answers I would like to use regex to identify laughing/funny words, such as: ahahah or hahaha. So the idea is to identify repeating ah or ha or lol, etc. In addition I would also like to identify ah ah ah. I l...
Titus Pullo
1

votes
1

answer
73

Views

regular expression for css url

In our one project we are appending css background image url with certain path in php that does not starts with 'http', 'website' or 'vendor', so far our expression is doing good but it is also including starting quote in result. Any help is appriciated here is my php code $array=[ 'url('images')',...
1

votes
1

answer
41

Views

Extracting multiple values after an exact string using regular expresions

I have 100s of .txt/.sed files with lots of lines in each. Sample input file: Time: 10:34:51.49,15:21:39.24 Box Temperature (K): 32.82,8.88,-10.07 Silicon Temperature (K): 10.90,9.88 Voltage: 7.52,7.41 Dark Mode: AUTO,AUTO Radiometric Calibration: RADIANCE Units: W/m^2/sr/nm GPS Time: n/a Satellite...
Brain_overflowed
1

votes
2

answer
29

Views

PHP regex subgroups cannot be captured

I have a regex pattern expected to capture the src and height (which is possibly in the height or style attribute) from some html elements. Here is my pattern: /img[^\>]*(?:height='([\d]+)')?[^\>]*src='([^']+)'[^\>]*(?:style\='height:([\d]+)px;?[^']+')?[^\>]*/i I use the preg_match_all function to...
micmia
1

votes
0

answer
251

Views

Search Exact Match R datatable

My issue is with the global search bar in the datatable package. I'm trying to set this global search bar to find an exact match. There're some java query based instructions here: search exact match and highlight jquery datatable regex However, I need to know how to do the same thing in Rstudio. I t...
Adel
1

votes
1

answer
39

Views

Reference Lookup Equation VBA

Hoping someone could help me out. I have this one line of code that I cannot understand why it throws a typemismatch error. What I am trying to accomplish is use index match to lookup a value and subtract, divide, add, ect. another value that is pulled with index match. I have searched everywhere...
krish86
1

votes
0

answer
77

Views

How to parse SQL dump file in PHP?

I have a hugh SQL Server dump file with a lot of tables, views, etc. I want to be able to get all content between 2 lines starting with create and finishing with go. I'm able to retrieve type and name with this expresion '~^(create)\\s(assembly|aggregate|table|synonym|trigger|view|function|procedure...
1

votes
0

answer
22

Views

How to fill up a large table with new data from small table by matching unique names in both tables. Fill columns but leave original data untouched?

I have large and a small table (in fact thousands of rows and columns). E.g. large small v3 v4 1 C 3.4 2 Y 6 This should be the result: > large.new v1 v2 1 1.0 A 2 2.0 E 3 3.4 C 4 4.0 B 5 NA G 6 6.0 H 7 NA Z 8 6.0 Y I tried merge() and match[] but they delete all the other data in t...
Sascha Rösner
1

votes
1

answer
35

Views

PHP preg_match to match season Numbers

I have the code below to grab the Season Number from a string. But it doesnt work OK as the season number is before any 'Season' Words. I tried to put (\d+)\s* in front of the pattern but then the code it did not return anything. How can i fix my preg_match to return the season number if it is befor...
OhGodWhy
1

votes
1

answer
895

Views

Remove elements/objects From Array in ElasticSearch Followed by Matching Query

I have below types documents. { '_index': 'example1', '_type': 'doc', '_id': '8036', '_score': 1, '_source': { 'user': 'kimchy8036', 'postDate': '2009-11-15T13:12:00', 'locations': [ [ 72.79887719999999, 21.193036000000003 ], [ -1.8262150000000001, 51.178881999999994 ] ] } } And below is mapping: {...
5a01d01P
1

votes
2

answer
87

Views

RegExp: before or after a delimiter

Consider the following use namespace; class name impl... { use Trait; } How would I go about it, if I would like to extract either the use from before the class definition or the one after? Well in the above example it would be simple enough, but if it should also work on an actual code file with m...
Daniel B
1

votes
1

answer
425

Views

replacing multiple matches in preg_replace_callback

I have a string which reads foo_bar_one, what I am trying to achieve is foo_Bar_One, using this regex /(?
Rehan
1

votes
0

answer
58

Views

Why wildcard character “*.*” can match a file without extension

There is a file 'a' in a directory. When I search by '.', I get 'a'. But the file 'a' doesn't have a extension and there is no dot in 'a'. Why?
Jerry Chou
0

votes
0

answer
5

Views

How to Get Single Value From Many Data With Preg_match_all

i have some data regarding my school i want to make a list of particular age students and teachers i have a example like this here is our data :- [{'groupnumber':1,'groupid':1737983,'users':[{'id':2949,'user_name':'vishal kumaar','role':'classmate','bonus':'9','image':'www.example.com/myusers-8601.p...
rinkesh1992
1

votes
4

answer
149

Views

preg_match to extract data from string

I have a string 'CPC >= $0 (Yesterday)' and I want to get data: CPC, >=, 0, Yesterday. However the sign >= can vary between few more signs but is always comparison sign. $str = 'CPC >= $0 (Yesterday)'; preg_match('/(?\w+) (?\w+) $(?\d+) \(((?\w+))\)/', $str, $matches); print_r($matches); This gives...
1

votes
2

answer
358

Views

Matching rows based on column value python pandas

I am working with financial data and I want to match timestamps of two stocks. The format I have (or can generate) is: A big dataframe with columns [timestamp1, ..., timestamp2, ....] or two seperate dataframe with columns [timestamp1, ..] [timestamp2, ...] with index type integer. I want to get a b...
Dennis
1

votes
1

answer
45

Views

Modify preg_replace to add span to both first letter and first word

I am using the following preg_replace code to add a -Tag around the first letter of a paragraph (in Wordpress):
nazim

View additional questions