Click here to Skip to main content
15,922,427 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
QuestionSOLVED Qt implementation of regular expression Pin
jana_hus17-Jun-24 4:38
jana_hus17-Jun-24 4:38 
AnswerRe: Qt implementation of regular expression Pin
Richard MacCutchan17-Jun-24 6:37
mveRichard MacCutchan17-Jun-24 6:37 
GeneralRe: Qt implementation of regular expression Pin
jeron117-Jun-24 6:58
jeron117-Jun-24 6:58 
GeneralRe: Qt implementation of regular expression Pin
Richard MacCutchan17-Jun-24 11:07
mveRichard MacCutchan17-Jun-24 11:07 
QuestionPositive Lookbehind question Pin
tasoss7-Jun-24 14:01
tasoss7-Jun-24 14:01 
AnswerRe: Positive Lookbehind question Pin
Terry R 20239-Jun-24 16:50
Terry R 20239-Jun-24 16:50 
GeneralRe: Positive Lookbehind question Pin
tasoss10-Jun-24 0:20
tasoss10-Jun-24 0:20 
QuestionREGEX to find space followed by number 1 then letter Pin
Richard Parker from London24-Apr-24 2:16
Richard Parker from London24-Apr-24 2:16 
AnswerRe: REGEX to find space followed by number 1 then letter Pin
Richard Deeming30-Apr-24 0:22
mveRichard Deeming30-Apr-24 0:22 
GeneralRe: REGEX to find space followed by number 1 then letter Pin
jschell30-Apr-24 12:21
jschell30-Apr-24 12:21 
QuestionPHP perl regular expression - URL not preceded by equal sign and possible single or double quote Pin
Doug Davis 202427-Mar-24 9:37
Doug Davis 202427-Mar-24 9:37 
QuestionModify Regex To Disallow Spaces Pin
mcfc4heatons26-Mar-24 11:03
mcfc4heatons26-Mar-24 11:03 
SuggestionRe: Modify Regex To Disallow Spaces Pin
Richard Deeming26-Mar-24 22:47
mveRichard Deeming26-Mar-24 22:47 
AnswerRe: Modify Regex To Disallow Spaces Pin
Terry R 202316-May-24 11:31
Terry R 202316-May-24 11:31 
I realise I've come to this post a long time after the request, but thought I'd still provide an actual way forward, possibly even the solution if one is still required. Or maybe it will serve some useful purpose for another poster with a similar need.

If you understand the regex you have provided you will understand the first 2 sections are only a lookahead to identify the requirements are met, they don't actually consume any characters.

The .{7,}$ is the part which grabs the password and at the moment it will grab any character (denoted by the DOT character). So it's here where you could do the final verification. What needs to happen is that the DOT changes to the "allowed" characters which exclude the space (and/or any other characters).

I don't do PHP regex but I would think replacing the DOT with something like \S or [^ ] or even [[:^space:]] would be appropriate. By removing a character from the allowed group, if the removed character is encountered the regex will fail. So no password is selected.

It could even be done with another lookahead and I think that could be (?=\S{7,}). If using the lookahead, then no need to change the DOT character for my other options.

Some background info:
\S is any character except whitespace which includes [ \t\r\n\v\f]. This is a capital S, which is the negated \s, so opposite of what \s means in PHP regex (whitespace).
[[:^space:]] is a negated PHP class, the ^ denotes NOT what follows.

Terry
QuestionMatching Floating Point Numbers Range with a Regular Expression Pin
Dagobert19-Feb-24 2:10
Dagobert19-Feb-24 2:10 
AnswerRe: Matching Floating Point Numbers Range with a Regular Expression Pin
Richard Deeming9-Feb-24 2:19
mveRichard Deeming9-Feb-24 2:19 
GeneralRe: Matching Floating Point Numbers Range with a Regular Expression Pin
trønderen9-Feb-24 6:25
trønderen9-Feb-24 6:25 
GeneralRe: Matching Floating Point Numbers Range with a Regular Expression Pin
Dagobert19-Feb-24 6:49
Dagobert19-Feb-24 6:49 
GeneralRe: Matching Floating Point Numbers Range with a Regular Expression Pin
jschell9-Feb-24 12:34
jschell9-Feb-24 12:34 
GeneralRe: Matching Floating Point Numbers Range with a Regular Expression Pin
Dagobert19-Feb-24 10:22
Dagobert19-Feb-24 10:22 
GeneralRe: Matching Floating Point Numbers Range with a Regular Expression Pin
jschell9-Feb-24 12:37
jschell9-Feb-24 12:37 
GeneralRe: Matching Floating Point Numbers Range with a Regular Expression Pin
Richard Deeming11-Feb-24 21:47
mveRichard Deeming11-Feb-24 21:47 
AnswerRe: Matching Floating Point Numbers Range with a Regular Expression Pin
Pete O'Hanlon12-Feb-24 0:04
mvePete O'Hanlon12-Feb-24 0:04 
QuestionRegular expression for City name Pin
KiranKumar V 20247-Feb-24 19:08
KiranKumar V 20247-Feb-24 19:08 
AnswerRe: Regular expression for City name Pin
Dave Kreskowiak7-Feb-24 19:19
mveDave Kreskowiak7-Feb-24 19:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.