Questions tagged as 'regex'

1
answer

Manipulation String postgresql?

I would like to manipulate a String with regexp_replace as follows: String to manipulate: 'TESTE <<TESTE1>> TESTE <<TESTE2>>' String after function: 'TESTE TESTE' I tried it this way: select r...
asked by 02.05.2018 / 16:33
2
answers

Chatbot in Python with NLTK

I'm a beginner in python, some time I've been interested in Text Mining and would like to ask for help with a question in a project. Some time I've been studying how to use the Python NLTK Library to create a chatbot. I even got to work ou...
asked by 24.01.2018 / 11:46
1
answer

Convert text links into html link

I saw the solution here Convert a link from text in a href link and several others and I ended up adapting to my need, but there are some problems. I need to convert the links and the links from image to image and hyperlink I'm doing the fo...
asked by 18.03.2015 / 01:57
2
answers

How to make Regex that accepts only numbers?

How do I use preg_match to only accept numbers? And can those numbers start with zero too? function formatacao_cpf_func(){ $regular = "/^[0-9]*$/"; if(preg_match($regular, $this->cpf)){ if(!is_numeric($this->cpf)){...
asked by 22.11.2017 / 00:11
1
answer

How to search for tags using Regular Expression?

I would like to create a regular expression that looks for tags: <b>, <p>, <i> How would you do this in regular expression?     
asked by 16.02.2017 / 17:45
1
answer

How to create a function that validates if there is a MySQL function in a given string?

I am looking for a function that identifies (return true) if there is a MySQL function in a string. These would be some examples of possible input to function. <?php $randomstrings = [ "foo", //String comum "NOW()", //Função sem pa...
asked by 12.07.2017 / 17:25
1
answer

Replace words

I would like to know how to compact the lines of a txt. For example, the lines are broken by \n but are still part of the same sentence. SOCIAL HISTORY:Denies tobacco or alcohol use. PHYSICAL EXAMINATION: VITAL SIGNS: Age 34, blood...
asked by 14.11.2016 / 14:27
1
answer

Which regular expression would be most appropriate for validating a Cronjob expression?

I want to learn a little more about regular expressions. I thought of a good exercise that will be validating if a cronjob expression is correct or not. So,thepossiblecombinationsbelowshouldreturntrueaccordingtotheso-calledregularexpression....
asked by 24.06.2016 / 19:10
2
answers

Regular expression to replace content of the src attribute of the html img tag

Hello, I do not understand almost anything of regular expression, so I wanted you to help me with an expression to replace only what I have between the double quotation marks in the src attribute of the html tag, that is, the content of this...
asked by 06.05.2016 / 22:10
1
answer

Return substring defined by blocks in Python, in the first occurrence

In python, I'm trying to catch a substring defined by blocks, however the word "blocks" repeats in the text and would like to get the substring up to the first occurrence of it. In this example, the return causes the last occurrence: import...
asked by 28.11.2018 / 17:45