Questions tagged [regex]

Regular expressions provide a declarative language to match patterns within strings. They are commonly used for string validation, parsing, and transformation. Since regular expressions are not fully standardized, all questions with this tag should also include a tag specifying the applicable programming language or tool. NOTE: Asking for HTML, JSON, etc. regexes tends to be met with negative reactions. If there is a parser for it, use that instead.

Filter by
Sorted by
Tagged with
-3
votes
1answer
24 views

regex for JSON only for one nested data [closed]

Hi guys do you know how to change this regex, that it only looks for test :
1
vote
1answer
48 views

pandas series match multiple keywords

Is there a direct python pandas method to match values of series and update different series with some string ? I couldn’t find any direct method of doing it. Here the match is to find a value in a ...
0
votes
1answer
29 views

Separate business emails from personal emails

I am working on a classification problem where I would like to separate business emails from personal emails to analyse their behaviours separately. I am thinking about using regex but after looking ...
1
vote
0answers
31 views

Fastest way to parse regex in R

I need to parse around 1.6k REGEX expressions such as the pair I am writing below. I have also around 7k documents (1/2 page long each in average) that need to be parsed according to the REGEX ...
1
vote
1answer
220 views

R Studio - grepl compare a column in a dataframe to a list of pattern

I have a column named "MATCH" in a dataframe and a list of patterns named "PATTERN". ...
1
vote
1answer
29 views

Text comparison: spot the differences

I would like to know what would be the best approach to compare two texts and see the differences between them. For example: ...
0
votes
1answer
30 views

Remove all characters following a certain character in a column of a dataset

I have a data set like the following, and the first column contains the groupings. However, some are labelled slightly differently. I need to remove all characters following the punctuation used (...
2
votes
1answer
106 views

How to validate regex based Resume parser efficiently

I am using rule based logic to extract features from resume. Basically I am trying to find if the candidate switched the company in less than 1 year. So I have the code in place to find it using ...
1
vote
1answer
26 views

Is the search for a specific n-gram the same like a string search?

Is the result of a search for a specific n-gram like sherlock+holmes equal to the result of a regex search for "sherlock holmes" in the same document corpus? So if i read about n-grams for certain ...
1
vote
1answer
49 views

How to generate abbrevations from shortend words in medical records

I have text files which contains medical history of a patients and would want to extract information out of it. Basically what want is generate english text of abbrevations,semantic category region,...
1
vote
2answers
62 views

How to improve regex while fetching record dynamically

The data is as follows: COL1 COL2 12 :402:agsh,hhjd,:45:hghgh,gruru,:12:fgh,ghgh,:22:hhhh 57 :42:agshhhjd,:57:hghgh,gruru,:120:fghghgh,:12:hhhhhh I ...
1
vote
2answers
22 views

Keeping part of a string in R [closed]

I have a dataframe with the following column city <- c("Sydney NSW", "Newcastle NSW", "Liverpool NSW", "Broken Hill NSW") I want to maintain everything prior ...
0
votes
2answers
219 views

Replace method in pandas not giving expected result

I have data as below: 123.12.23.2 110.22.21.23 I want to mask this data as below one 1xx.xx.xx.x So I tried below code : ...
0
votes
1answer
59 views

How to filter out a portion of the text data with re.match or any other regex method with Python?

I have the following data : ...
4
votes
3answers
795 views

Machine learning or NLP approach to convert string about month ,year into dates

I'm currently in the process of developing a program with the capability of converting human style of representing year into actual dates. Example : last year last month into December 2018 string may ...
1
vote
0answers
200 views

simplifying AND OR Boolean Expression [closed]

My problem is turning a string that looks like this. "a OR (b AND c)" into a OR bc if the expression is like ...
1
vote
1answer
136 views

Tagging Unix/Non-Unix logs using NLP

I have a set of unstructured data consisting command output logs for different operating systems like Unix, Windows, etc. For example: Releasing version 0.0.1 for Stackoverflow, on 01/01/2019. The ...
4
votes
1answer
461 views

Regex-style pattern-matching for time series

This is more of a "what technology/library would you use for this?" question than anything else. I have categorical time series data, and need to match cases in these time series to known patterns. ...
4
votes
1answer
173 views

How to automatically verify official documents?

I am new to machine learning and data science. I apologise if the question seems very basic. I have a requirement where I need to verify information submitted via a form with the corresponding ...
4
votes
2answers
12k views

regex to remove repeating words in a sentence

I am new to regex. I am working on a project where i need to replace repeating words with that word. for example: I need need to learn regex regex from scratch. I need to change it to: I need ...
2
votes
1answer
2k views
2
votes
1answer
260 views

Facing a difficult regular expression issue in cleaning text data

I am trying to substitute a sequence of words with some symbols from a long string appearing in multiple documents. As an example, suppose I want to remove: ...
0
votes
1answer
1k views

Regex remove 1-2 character sequences: hyphens literal, not word boundaries [closed]

I need a regex in R to exclude 1 or 2-character words, but which does not treat hyphens as word boundaries. Here is an example: ...
2
votes
1answer
4k views

How to improve OCR (Scanning) results?"

Below is text output obtained after ocr image to string of medical discharge summary report. ...
0
votes
3answers
383 views

Using training data generated with pure regular expressions - Can machine learning surpass the accuracy of your regular expression?

For text classification with machine learning - If your training data was generated purely with regular expressions, is it possible to train a machine learning model with this training data which will ...
2
votes
2answers
1k views

Regular expression in python -

I want to extract the values of the below text ...
4
votes
2answers
2k views

What is the best approach for specified optical character recognition?

I have a quite understandable request of extracting information (invoice number, invoice data, due date, total etc.) from scanned invoices (the digital format is image, not PDF), preferably in Python. ...
1
vote
1answer
5k views

R: remove single characters from string

I have a huge string in R where I want to remove single characters from. So for example, the string might be blabla a test this that b á And the result should be ...
1
vote
1answer
845 views

Using regex in redshift to find dollar values

I have a field in a Redshift table that has user-generated text. The field is where users can say how much they think something costs. Ideally it'd just be a decimal, but it's varchar. So users can ...