Questions tagged as 'regex'

1
answer

Excluding symbol from the last position of a string, optimally with PHP [closed]

I would like to delete the last character of a string if it is a symbol. I know I could do it in a complex way like the following function: $string = "minha_string_com_simbolo_no_final_"; function excluir($string){ $simbolos = ["'","\"",...
asked by 06.07.2016 / 22:47
1
answer

Friendly URL with Generic Parameters .htaccess [duplicate]

I would like to set up a URL friendly with generic parameters, that is, receive any parameter in any quantity or file. Today I set the .htaccess so that the filename becomes URL . File I'm using: <IfModule mod_rewri...
asked by 18.01.2016 / 12:01
3
answers

Allow only letters, numbers and hyphen

How to validate a string in php so that it contains only letters, numbers, and hyphen (-) Thank you     
asked by 01.04.2016 / 00:22
3
answers

How to do a look-behind using quantifiers like "\ d +"?

I need to match the text "test", but not always the string will start with a fixed number of characters / digits, it may start with any number of characters, eg: 001 test 0002 test 20458 test How do I make the regexp below work...
asked by 24.05.2017 / 21:21
2
answers

Regex with javascript to capture words between two characters

My problem is as follows: let texto = "teste :1: e também teste :2:" What I need to do is basically take the positions where these characters appear: 1: and: 2: with regex, since what appears between the two points is dynamic. I...
asked by 08.07.2018 / 15:13
2
answers

How do you capture the hours in a String?

I'm making a javascript code in which I'll need to split a sentence so I search the hours, I want only the value of them and so I can separate them, to put the value separately. Ex: String: 11:11 as 22:22 / 33:33 as 44:44 / 55:55 as 66:66 S...
asked by 04.01.2019 / 12:00
2
answers

Regex for monetary values

I would like to know how to make a regex to capture a monetary value with semicolons. Ex: 7.300.250,00     
asked by 12.11.2018 / 16:04
3
answers

Replace list of words in a text

I always have a lot of trouble with replace and sub. I know how they work, but it never works for me. I have a list of words and I am trying to replace these words in a text: Text:    Brazil, officially the Federative Republic of Brazil...
asked by 17.07.2018 / 14:52
4
answers

Regex to get a text between

I'm trying to get a word between <> . For example: Text: "Joao <[email protected]>" My regex should catch [email protected] , but it's catching <[email protected]> The regex I am using is <(.*?)>...
asked by 13.11.2015 / 20:46
2
answers

Regular expression

Regular expression for a password validation. I want it to be possible at least a lowercase letter, a capital letter, at least a number and special characters (/, _, -, ...). Example: $regex = '#^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$#...
asked by 09.02.2017 / 12:12