Skip to content

Regular Expressions

Regular Expressions discussions

This category can be followed from the open social web via the handle regular-expressions@forum.codeproject.com

188 Topics 829 Posts
  • Help building expression

    help
    3
    0 Votes
    3 Posts
    36 Views
    J
    Your solution works great! Thanks a lot for your help :)
  • SOLVED Qt implementation of regular expression

    help regex
    4
    0 Votes
    4 Posts
    22 Views
    L
    The excuse and instructions at the beginning of the generally messy question. Still can't (or won't) use <pre> tags properly. For some reason closed his previous account recently. So now comes back with a new id but the form of his question is the same as always.
  • How to change the object of regular expression?

    regex help tutorial question
    1
    0 Votes
    1 Posts
    12 Views
    No one has replied
  • Positive Lookbehind question

    question
    3
    0 Votes
    3 Posts
    18 Views
    T
    Hello and thank you very much for your reply. Firstly i have to read the article you have mentioned and then we can talk again. But i believe this You see the expression (?<=) can be used both as lookbehind before the match and lookbehind after the match. is the most important thing that i didn't know. Can you choose if (?<=) will be treated as before or after only ??? (i will found out after reading the article :)
  • Modify Regex To Disallow Spaces

    question php regex
    3
    0 Votes
    3 Posts
    20 Views
    T
    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
  • REGEX to find space followed by number 1 then letter

    regex help tutorial
    3
    0 Votes
    3 Posts
    15 Views
    J
    Richard Deeming wrote: you're using - PHP, JavaScript, .NET, etc At least for those I don't think it matters. All of those (and Java) use for the most part a fully compatible version of regex which matches Perl.
  • 0 Votes
    1 Posts
    6 Views
    No one has replied
  • 0 Votes
    9 Posts
    41 Views
    P
    If all you are doing is trying to validate (in a QLineEdit) that a floating point number is in a particular range, why don't you use a QDoubleValidator with it? This allows you to set range values[^]. Advanced TypeScript Programming Projects
  • Regular expression for City name

    regex question
    15
    0 Votes
    15 Posts
    66 Views
    J
    Richard Deeming wrote: but its never going to be 100% accurate. Was the phrasing in my response not clear? I thought I was pointing that out in several places.
  • 0 Votes
    2 Posts
    16 Views
    J
    This forum is for regex in general. So specifics to fail2ban are not likely to succeed. Googling I found other posts about this although I did not look into it deeply. fail2ban ah01264 Based on that seems possible at least. But in general "error messages" across all applications are seldom well regulated. Thus attempts to capture them either lead to too few or too many. Until one has enough actual examples to code to. Even then updates might change that. For this forum you can post a regex and examples and we can correct the regex from that.
  • Help for a regexp

    python tools regex help tutorial
    3
    0 Votes
    3 Posts
    19 Views
    S
    Yes, based on kernel it's true.
  • Help for a regexp

    python tools regex help tutorial
    1
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • 0 Votes
    2 Posts
    15 Views
    J
    I doubt this is a regular expression problem. Best I can figure out you have files in directory A and you want to copy some of those to B. Then I can't follow what you want because it is either to overwrite or for the missing ones. In either case you will need a loop - which has nothing to do with regular expressions.
  • 0 Votes
    2 Posts
    15 Views
    Richard DeemingR
    Find _{2,} and replace with _. regex101: build, test, and debug regex[^] "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • pattern replace with specific exception

    regex python question
    3
    0 Votes
    3 Posts
    19 Views
    J
    When you want to search and replace specific patterns of text, use regular expressions. They can help you in pattern matching, parsing, filtering of results, and so on. Once you learn the regex syntax, you can use it for almost any language. Press Ctrl 0R to open the search and replace pane.
  • how to validate if input is either a - or digits

    regex tutorial question
    1
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • Replacement of initial words

    12
    0 Votes
    12 Posts
    52 Views
    T
    Given the conversation here and that you were equally sparse on words in your question on the Notepad++ forum https://community.notepad-plus-plus.org/topic/25021/regular-formulas it does seem that you don't read the replies properly and respond with a LOT more information. If it wasn't for the pigeon English feel I'd almost say this is an AI conversation. Terry
  • Exclude Uppercase for conjoined names

    tutorial regex help question learning
    13
    0 Votes
    13 Posts
    58 Views
    OriginalGriffO
    There are also English (and Welsh) surnames that start with "ff": it indicated "son of" in Middle Age English and was a single letter - literally an uppercase "F" was written as "ff" Until the end of the Middle Ages the initial capitalization of any name wasn't a thing - names were all written in lowercase. Some rich people* kept the lowercase starter to this day (and can get very shirty if you use uppercase!) * Who mostly were the only ones with surnames anyway, they didn't become common practice until the aftermath of the Black Death. "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
  • Regular Expression for a repeating pattern?

    regex question
    5
    0 Votes
    5 Posts
    28 Views
    K
    In general, trying to parse XML (or HTML) with regex is not a good idea, and almost certainly doomed to failure. However, to match this specific case you might try: (  *)+" That's an extended POSIX regex, and seems to do the job. It matches any of the following:                    If you need to accept any white space you might try using (&nbsp;[[:space:]]*) as the sub-pattern. If you may have line breaks in the span text, then you may need to tell your regex engine to not treat them as end-of-text markers. Keep Calm and Carry On
  • 0 Votes
    2 Posts
    16 Views
    M
    Old post but... I think this should work (for anyone who has a similar need). You can change the 1 to 0 if you want to avoid lines that begin with "0." as well. Also note that "aa." (or similar) will be matched/returned, since the request was to specifically avoid lines that start with a SINGLE letter (a, b, c, d) followed by a period. But this is easy to adjust as necessary if multiple letters followed by a period should also be skipped/avoided. ^(?![1-9]+\.|[a-d]\.).+$