string-matching

Regex match before string comes up

不羁的心 提交于 2019-12-13 08:49:11
问题 So i have this file of 10,000+ lines of messages from a game server, like so: 11.07.23 08:40:16 [INFO] NC: Moving violation: wolfman98 from yasmp (-90.8, 64.0, 167.5) to (-90.7, 64.0, 167.3) distance (0.0, 0.0, 0.2) 11.07.23 10:57:44 [INFO] NC: Moving violation: AKxiZeroDark from yasmp (-1228.3, 11.2, 1098.7) to (-1228.3, 11.2, 1098.7) distance (0.0, 0.0, 0.0) The current regex code i have is: \d{1,4}\.\d{1} , which matches so far everything in bold: 11.07.23 08:40:16 [INFO] NC: Moving

detect if a combination of string objects from an array matches against any commands

倖福魔咒の 提交于 2019-12-13 06:02:37
问题 Please be patient and read my current scenario. My question is below. My application takes in speech input and is successfully able to group words that match together to form either one word or a group of words - called phrases; be it a name , an action , a pet , or a time frame. I have a master list of the phrases that are allowed and are stored in their respective arrays. So I have the following arrays validNamesArray , validActionsArray , validPetsArray , and a validTimeFramesArray . A new

String manipulation for VML Path

痴心易碎 提交于 2019-12-13 03:55:17
问题 Hi I am trying to parse VML Path value using Java String manipulation. I want to retreive all the commands in the path like MoveTo , LineTo , CurveTo , RLineTo (other commands) and their corresponding x and y coordinates/parameters. Here are example data to parse, each command has their own x,y coordinates. 1. m1,1 l1,200,200,200,200,1 xe 2. m, l1,200,200,200,200,1 xe Can you suggest an algorithm or code on retreiving the commands and the parameters for each command? For example in number 1.

approximate string matching within single list - r

耗尽温柔 提交于 2019-12-12 14:22:13
问题 I have a list in a data frame of thousands of names in a long list. Many of the names have small differences in them which make them slightly different. I would like to find a way to match these names. For example: names <- c('jon smith','jon, smith','Jon Smith','jon smith et al','bob seger','bob, seger','bobby seger','bob seger jr.') I've looked at amatch in the stringdist function, as well as agrep , but these all require a master list of names that are used to match another list of names

How can I implement wildcard at ismember function of matlab?

北城以北 提交于 2019-12-12 09:28:17
问题 How can I do the implementation doing this in matlab; ismember(file_names,['*.mp4']) 回答1: I would do that with regexp , like this: result = ~cellfun(@isempty,(regexp(file_names,'\.mp4$'))); For example, file_names = {'aaa.mp4','bbb.mp3'}; gives result = 1 0 回答2: Using regular expressions (regexp) This can be easily achieved with regexp: tf = ~cellfun('isempty', regexp(file_names, '.*\.mp4')); If you want to force the pattern matching to the beginning or the end of the filename, you should add

One of strings in array to match an expression

柔情痞子 提交于 2019-12-12 07:41:48
问题 The Problem: I have an array of promises which is resolved to an array of strings . Now the test should pass if at least one of the strings matches a regular expression. Currently, I solve it using simple string concatenation: protractor.promise.all([text1, text2, text3]).then(function (values) { expect(values[0] + values[1] + values[2]).toMatch(/expression/); }); Obviously, this does not scale well and is not particularly readable. The Question: Is is possible to solve it using a custom

Matching 2 strings in C#

徘徊边缘 提交于 2019-12-12 06:39:52
问题 I have 2 strings. These 2 strings can differ in size. I want to look at these 2 strings finding matching sequences. Once I find a change I want to print that word in Capital and then continue on in my string until I find another change and so on. I'm not sure how I would go about this I tried looking at words as a whole but I'm having issues with that. Basically I will have 2 string something like this string one="This is a new value" and string two= "This This is a new also brand value ". I

Why Lucene algorithm not working for Exact String in Java?

馋奶兔 提交于 2019-12-12 02:54:51
问题 I am working on Lucene Algorithm in Java . We have 100K stop names in MySQL Database. The stop names are like NEW YORK PENN STATION, NEWARK PENN STATION, NEWARK BROAD ST, NEW PROVIDENCE etc When user gives a search input like NEW YORK , we get the NEW YORK PENN STATION stop in a result, but when user gives exact NEW YORK PENN STATION in a search input then it returns zero results. My Code is - public ArrayList<String> getSimilarString(ArrayList<String> source, String querystr) { ArrayList

Regex fails to match string

纵饮孤独 提交于 2019-12-12 01:29:13
问题 I have a piece of code below which I am trying to use to match the start and the end of a string where the middle can change. I am first trying to get this example working could someone please tell me the error with this code and why it is not matching at all. string pattern = @"/\/>[^<]*abc/"; string text = @"<foo/> hello first abc hello second abc <bar/> hello third abc"; Regex r = new Regex(pattern, RegexOptions.IgnoreCase); Match m = r.Match(text); 回答1: You don't need the delimiters, in c

Why this regex not giving expected output?

空扰寡人 提交于 2019-12-12 00:34:35
问题 i have string which contains some value as given below. i want to replace the html img tags containing specific customerId with some new text. i tried small java program which is not giving me expected output.here is the program info My input string is String inputText = "Starting here.. <img src=\"getCustomers.do?custCode=2&customerId=3334&param1=123/></p>" + "<p>someText</p><img src=\"getCustomers.do?custCode=2&customerId=3340&param2=456/> ..Ending here"; Regex is String regex = "(?s)\\<img