Questions tagged [string-search]

String searching algorithms (also known as string matching algorithms) are an important class of string algorithms that try to find a place where one or several strings (also called patterns) are found within a larger string or text.

Filter by
Sorted by
Tagged with
0 votes
2 answers
85 views

SQL WHERE statement where string can differ maximum one char but otherwise be equal

I am trying to create a SQL WHERE statement to compare strings that its allowed that maximum one character is different but still must be same length. I have tried using substring search with LIKE ...
ArturM's user avatar
  • 179
0 votes
0 answers
45 views

Error when using extract method in python not , "nothing to repeat at position 1"

I am a beginner to python and I am trying to search a certain string and extract 120 characters of text following the searched string from an excel cell in a table. I am trying to use the extract ...
Raj's user avatar
  • 1
0 votes
0 answers
54 views

How to rigorously compare my String-Search algorithm against current benchmarks. Currently beating/equaling Boyer-Moore ~half the times in my test

A String Search algorithm I wrote is performing incredibly well in my own test, but I'd like to test it more rigorously to know how well it objectively performs. Anyone know of a resource I can use to ...
Menachem Kalmenson's user avatar
0 votes
0 answers
14 views

KMP Skip Table not producing the correct output

I can't figure out where I am going wrong, could someone please advise as you can see my output is really close to what I want but I can't figure out what checks/conditions I am missing `public class ...
Fidah Ali's user avatar
0 votes
0 answers
32 views

SSRS Search Multi-Select Parameter using Text Paramater where the resulting items in Multi-select list are filterable

I've create two parameters p_search and p_destination. Have two datasets, main data set and destination dataset. The Main Dataset query to pull all data for report has this where clause: where ...
Dolores M's user avatar
0 votes
3 answers
322 views

How to extract elements of strings in a list based on the presence of a substring in python?

I have a list which contains elements of strings. I am trying to capture the elements if it has specific substring into another variable by removing it in the original list. Org_list = ["I am ...
Sujith Voona's user avatar
0 votes
0 answers
26 views

How to get the percentage of matched text using the kmp and naive string algorithms in js , node and express js?

I'm finding it difficult to retrieve the percentage of matched text for a plagiarism project I'm working on. The project is being built via Node and Express JS. The matched text occurs from comparing ...
Jenny Emenike's user avatar
0 votes
2 answers
87 views

How to search a string within another string which has spaces before or after for exact matches [duplicate]

I need to search a string within another string with exact match and without spaces in Python. For example searching string2 in string1 as below should be True (or a match, then I can convert it to ...
ControltheAI's user avatar
-2 votes
1 answer
54 views

Writing a simple function which returns True if there is a duplicate character present

So basically as in the title. Here is what I am trying to do: 3 24 function RepeatedChar (l: char; s: string): boolean; 25 var 26 c, ordl, ords: integer; {counter} 27 begin 28 c := 0; 29 ...
Rookie's user avatar
  • 3
0 votes
0 answers
52 views

How does multiple keyword search works internally using grep

I am trying to find, how grep works internally while searching for multiple keywords. ex:- grep -inrE "keyword1|keyword2|keyword3" For a single keyword search, grep uses boyer's-moore ...
SampathKumar Esikala's user avatar
0 votes
0 answers
326 views

Search for a string in folders & subfolders, and pull its information in the same sheet

Daily, I need to check serial numbers to see whether it is invoiced. We have a system that generates the invoices and exports in the C:\Serial_Numbers location path, and the invoice number is always ...
martel_9's user avatar
1 vote
2 answers
38 views

String search with dynamic lengths against a file

The task I am trying to perform is: e.g. I have a string "Simultaneously", I would like to perform a search of this string with dynamic lengths against strings in a file (contains some ...
indigo's user avatar
  • 23
-1 votes
1 answer
70 views

find a text in elements of list if exists append it to a new list

list = ['0-0-0-0-0-4-0', '0-0-0-1-0-4-2', '0-0-3-0-0-80-0', '0-0-3-1-0-81-0', '0-0-3-0-0-82-0'] appendlist = ['0-0-3-0'] search for first 7 digit of element like that 0-0-3-0 occurance 2 times '0-0-...
user289017's user avatar
0 votes
0 answers
37 views

Fast Phrase Matching Algorithm

Say I have a list containing the following sentences. The party was a huge success. Sadie made a list of things she needs to buy. Mom made me a sandwich. I want to do phrase matching, possibly ...
vcmkrtchyan's user avatar
  • 2,524
0 votes
2 answers
260 views

Algorithms and techniques for string search across multiple GiB of text files

I have to create a utility that searches through 40 to 60 GiB of text files as quick as possible. Each file has around 50 MB of data that consists of log lines (about 630.000 lines per file). A NOSQL ...
user avatar
0 votes
0 answers
35 views

How do I search a string from a file and return the line location using functions in C++?

I am trying to make a program that lets me search for groups of words in a file and then it would return the line locations where they are found. I made it work for a little bit but for some reason, ...
PatPatis's user avatar
0 votes
1 answer
96 views

Hide list item using data attribute when specific text is present on the page with JS

This is trying to hide a checkout payment option from appearing when specific items are in cart (shown on the same page). If the text "BULK" appears in the cart/page to hide a list option ...
Paul C.'s user avatar
0 votes
0 answers
167 views

Common Keyword/ Substring in a List of Company Name

Suppose I have several lists of company names which are all operating in the steel and property industries, respectively. How to guess a company industry based on the current list? example: steel=['...
lazzaknight's user avatar
0 votes
3 answers
135 views

Am I misunderstanding find_first_not_of?

Consider the following program: #include <string> #include <iostream> int main() { std::string token {"abc"}; const char* option_name_valid_chars = "...
einpoklum's user avatar
  • 121k
1 vote
3 answers
129 views

Looking for a string in text file with python

I'm trying to look for a string in text file. Technically, my code supposed to work, I was define a key to search, which is the string I'm looking for and I checked the whole file line after line. ...
I'm not a robot's user avatar
1 vote
0 answers
118 views

Understanding Rabin-Karp algorithm with modulo arithmetic

I am having a hard time understanding the Rabin-Karp algorithm with modulo arithmetic. My questions. Why we use modulus to determine the hash of the string being analyzed? How to determine the ...
shehan chanuka's user avatar
1 vote
0 answers
32 views

Force python to read file with arbitrary extension as .txt file from archive using zipfile [duplicate]

Thank you snakecharmerb. This was my solution. Thank you for helping an io amateur. Occasionally throws errors, which doesn't happen if I decompress then search, but now I'm off and running. I've ...
Matt Reed's user avatar
0 votes
0 answers
322 views

finding a string in a large text and return the paragraph which the string is in that paragraph

Hi I wanna search a string in a large text and return the paragraph which involve the string. (In Python) Here is the example of the data that need to be searched: https://raw.githubusercontent.com/...
Sarnia's user avatar
  • 1
1 vote
1 answer
140 views

How is the most efficient way to intersect a list of strings with a numpy array of matches?

I am using aho corasick to performing some string searches on documents. The original code uses numpy array to store in an efficient way the matches of each string of a string list: import ahocorasick ...
celsowm's user avatar
  • 558
0 votes
2 answers
81 views

Debugging, I am trying to find where in this code these errors coming from

Attempting to diagnose this output from a script I have to debug. make[1]: Entering directory '/home/dwulf/sifchain/sifchain-validators' /bin/sh: 1: Syntax error: Unterminated quoted string make[1]: **...
dwulf's user avatar
  • 3
1 vote
2 answers
461 views

How to efficiently check page text for a list of keywords in Selenium?

I have a list of keywords (['a', 'b', 'c']) and I'd like to check which appear on a given page, using Selenium (ideally each with the number of occurrences). The naive way would be to look for each ...
rudolfovic's user avatar
  • 3,173
1 vote
1 answer
259 views

Can CRC32 be used as a "Rolling Hash" as with the Rabin–Karp string search algorithm?

I have a hardware CRC32 peripheral on a MCU that I would like to use to speed up string search. Normally this is done with one of the rolling hash functions described here https://en.wikipedia.org/...
MFlamer's user avatar
  • 2,350
0 votes
1 answer
104 views

Trying to get prefix table for the pattern in KMP algorithm

I'm trying to implement KMP algorithm for string matching, basically i have my pattern tenen which needs to be searched in a specific string lets assume that string to be this is ten in tenen. I'm ...
Nithin Jain's user avatar
0 votes
1 answer
115 views

Algorithm to recursively search Git repo for a string

I am working on a project to automate the code review process for a team of engineers. Basically, what happens is every time an engineer makes a change to a file, before those changes are pushed to ...
xinianyuh's user avatar
1 vote
2 answers
958 views

String search by coincidence?

I just wanted to know if there's a simple way to search a string by coincidence with another one in Python. Or if anyone knows how it could be done. To make myself clear I'll do an example. ...
Pomodor0's user avatar
0 votes
0 answers
51 views

Match block of strings from a text file

i read multiple discussions similar to my issue but i can't find a working solution! I have a txt file make like that: blah L1 blah **ON** ...(uninteresting) ...(uninteresting) conf1 ...(...
Gipsy's user avatar
  • 61
0 votes
1 answer
634 views

Python: Find If Substring Exists in String Given Condition

I'm trying to optimize this solution for a function that accepts 2 arguments: fullstring and substring. The function will return True if the substring exists in the fullstring, and False if it does ...
Riley Hun's user avatar
  • 2,613
2 votes
1 answer
338 views

Check if substring of a string exists in datatable

I have a DataTable like this: column1 column2 ----------- ---------- 1 abc d Alpha 2 ab Gamma 3 abc de Harry 4 xyz Peter I want to check if a substring of a string ...
Scorpion's user avatar
0 votes
1 answer
137 views

R: Removing substring by occurrence of character

I have a vector, species_name, in dataframe genexp_2016 which contains the common and scientific names, as well as the location of several different species. For example, species_name strings may be ...
A Hazardous Galaxy Note 7's user avatar
1 vote
0 answers
155 views

Algorithm to Check if Strings are Equal Allowing Rotations and up to K Replacements

Imagine the problem of finding if one string "STR1" is a rotated version of another string "STR2". This problem is simple and just requires searching for either string in the other ...
teleni's user avatar
  • 13
2 votes
1 answer
163 views

string search across multiple buffers algorithm

I'm developing a NGINX module and need to do a complex string replacement in the response body on the fly without a cumulative buffer (See the below ngx_http_output_body_filter_by_me). Sometime, the ...
samm's user avatar
  • 640
-1 votes
1 answer
89 views

Compare first word of each line of a file to a variable in php

I've just started php and I can't find an easy way to compare to a variable each first word of a line of a text file in a format("userid firstname lastname password").
Ryan's user avatar
  • 29
0 votes
1 answer
345 views

Looking for a powershell script that takes latest txt file in directory and searches for keyword "RequriedString"

$dir = "C:\temp" $latest = Get-ChildItem -Recurse -Filter filename*.txt -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 1 $SEL = get-content $latest if( $SEL -...
Kinshu's user avatar
  • 13
1 vote
1 answer
497 views

Python: Provide a string, open folder that contains the string in the folder name, then open/read a file in that folder

I have a highly branched folder structure as shown below. I want to match a barcode, which is nested between other descriptors and open/read a file of interest in that barcode's folder. The contents ...
SMadden's user avatar
  • 49
0 votes
1 answer
391 views

Brute Force Searching in C programming, reading a .fna file in C programming

I am able to read a .fna and search for the pattern I want. But after I read the file, it is reading it line by line and not the whole. How can I extract a .fna file and store as a variable in C ...
Help's user avatar
  • 1
0 votes
2 answers
52 views

how to search the result from a string input in a list

Hi i need to make a project for school where people can insert a review but before the review is posted on twitter it is going to be placed in a database. before it is going to be posted in twitter a ...
user avatar
0 votes
0 answers
65 views

Dotnet string searching ambiguity (netcore31 vs net47 vs roslyn)

I found out that in some cases string.IndexOf() returns -1 when searching for double line break \r\n\r\n when it is followed by 0xCC (204) byte sequence (could be also others, haven't checked). Below ...
andy250's user avatar
  • 19.6k
-1 votes
3 answers
873 views

Find out the maximum number of decimal places within a string of numbers

The string looks like this like something along the lines of 3*2.2or 6+3.1*3.21 or (1+2)*3,1+(1.22+3) or 0.1+1+2.2423+2.1 it can vary a bit. I have to find the amount of decimal places in the number ...
Sofia's user avatar
  • 147
1 vote
2 answers
155 views

Check if 1 of multiple chars are in a string, return true if atleast one is

So this checks wether all of the contents are inside a string, and only returns true if that is the case. function check(Entry) { var contents = "abcd"; for (var i = 0; i < Entry.length; i++...
Sofia's user avatar
  • 147
1 vote
1 answer
58 views

How do I open a list of txt files, convert them to strings, and then see if they match any keys from a given dictionary [closed]

I have a list of text files (list_4), of the format cv1.txt, cv2.txt, cv3.txt etc, up to cv20.txt. I want to use a for loop to open and read these files indivdually and convert them into strings. This ...
AndrewLittle1's user avatar
5 votes
1 answer
3k views

Is time Complexity O(nm) equal to O(n^2) if m <= n

I am studying the time complexity of an algorithm to find if a string n contains a substring m where m <= n. The result of the analysis is that the time complexity is O(nm). So taking this time ...
abnerabbey's user avatar
5 votes
1 answer
132 views

Product name string matching against a trie (supporting omissions)

I have a list of CPU models. Right now, I think the most suitable approach would be forming a trie from the list, like this: Intel -- Core -- i -- 3 | | |- 5 | | |- 7 ...
Rafael Sofi-zada's user avatar
0 votes
4 answers
53 views

Search if all string in .txt

I am trying to run a program to look at a .txt file and if, else depending on the content I thought would be Searhterms = [A, B] with('output.txt') as f: if ('A' and 'B') in f.read(): ...
Smellegg's user avatar
1 vote
1 answer
123 views

Find occurrences of the adjacent sub strings in the text

I have a text of the Word document and an array of the strings. The goal is to find all occurrences for those strings in the document's text. I tried to use Aho-Corasick string matching in C# ...
alex.z's user avatar
  • 35
0 votes
2 answers
3k views

Teradata string/text search

I have 2 tables in teradata. TableA and TableB TableA has 2 columns as shown below Table A Column 1 --> Databasename Column 2 --> Tablename TableB has multiple columns including a text column. I ...
nofel's user avatar
  • 1

1
2 3 4 5 6