## javascript – Regex for password must contain at least eight characters, at least one number and lower and upper case letters and special characters

I would answer Peter Mortensen, but I don't have enough reputation.

Its expressions are perfect for each of the minimum requirements specified. The problem with its expressions that don't require special characters is that they don't allow special characters either, so they also impose maximum requirements, which I don't believe the OP asked. Normally, you want to allow your users to make their password as strong as they want; why restrict strong passwords?

Thus, its expression "at least eight characters, at least one letter and one number":

`^(?=.*(A-Za-z))(?=.*d)(A-Za-zd){8,}\$`

meets minimum requirement, but remaining characters may only be letters and numbers. To allow (but not require) special characters, you should use something like:

`^(?=.*(A-Za-z))(?=.*d).{8,}\$` to allow all characters

or

`^(?=.*(A-Za-z))(?=.*d)(A-Za-zd\$@\$!%*#?&){8,}\$` to allow specific special characters

Likewise, "at least eight characters, at least one uppercase letter, one lowercase letter and one number:"

`^(?=.*(a-z))(?=.*(A-Z))(?=.*d)(a-zA-Zd){8,}\$`

meets this minimum requirement but only authorizes letters and numbers. Use:

`^(?=.*(a-z))(?=.*(A-Z))(?=.*d).{8,}\$` to allow all characters

or

`^(?=.*(a-z))(?=.*(A-Z))(?=.*d)(A-Za-zd\$@\$!%*?&){8,}` to allow specific special characters.

## performances – Brute force md5 corresponding regex checksum

The code starts with 128 bits of 0 (size of `md5sum` checksum) then brutally forces to find the checksum corresponding to the regular expression (all characters of the checksum in hexadecimal are numbers). I know there may be collisions and that the 2 ^ 128 possible checksums will not all come out.

I know that if the code is executed, it will not end anytime soon. I will try to read how I can change the `for` parallel loop `for` loop that uses all the processor cores.

It was one of my first (not very useful) programs in Golang. Any constructive comments are welcome.

Production:

``````0000000000000000000000000092FE92    14275262221639818016075488414463
000000000000000000000000009FF5EA    56052719788687373369347657641554
00000000000000000000000000BA7A1D    25521851964074241922881283516897
00000000000000000000000000E13807    19356247379454983142782955697777
00000000000000000000000000E8C976    64115693827254722796959498140064
0000000000000000000000000109658F    87596081213274701373126754303410
...
``````
``````package main

import (
"crypto/md5"
"encoding/hex"
"fmt"
"regexp"
"strings"
)

func main() {
data := ()byte("x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00")

r, _ := regexp.Compile("^(0-9){32}\$")

for {
hash := md5.Sum(data)
hash_hex_string := hex.EncodeToString(hash(:))

if (r.MatchString(hash_hex_string)) {
fmt.Printf("%X    %sn", data, strings.ToUpper(hash_hex_string))
}

if (!increment(data, 15)) {
break
}
}
}

func increment(data ()byte, start_pos int) (bool) {
if (start_pos < 0) {
return false
}

data(start_pos)++

if (data(start_pos) == 0) {
return increment(data, start_pos - 1)
}

return true
}
$$```$$
``````

## regex – How to remove accents and special characters in Java?

I have a text string, which you don't want to have accents or special characters.

I read about the property `replaceAll` and the `Pattern` In Java and using regular expressions, the problem is that this is a new theme for me and I cannot implement it.

In theory: If my characters are "áÁéÉíÍóÓúÚäÄëËïÏöÖüÜñÑ" should be "aAeEiIoOuUaAeEiIoOuUnÑ" and do not accept special characters.

regular expression 1: (! "# \$% & & # 39; () * +,
-. / :;<=>? @ (
) ^ _ ‘{|} ~)

regex 2 áÁéÉíÍóÓúÚäÄëËïÏöÖüÜñÑ

## c # – Regex nested structure with special characters

I need to find a Regex in C # that matches and returns strings from a nested structure delimited by \$ (and) \$.

My input string is:

`\$(string1\$(string2)\$sometexthere\$(string3\$(string4)\$texttext)\$anothertext)\$`

The output must be:

``````\$(string1\$(string2)\$sometexthere\$(string3\$(string4)\$texttext)\$anothertext)\$
\$(string2)\$
\$(string3\$(string4)\$texttext)\$
\$(string4)\$
``````

I tried with this regex `\$((^\$)*)\$` but it only returns the innermost `string2` and `string4`.

Is there a solution to return each correspondence with regex? or even through a loop? (( `\$(` and `)\$` can be replaced afterwards by `(` and `)` )

## htaccess – Can I use REGEX to 301 an URL with extra characters at the end?

I just configured PHPlist to manage my email subscribers.

https://www.example.com/lists/?p=subscribe&id=1

I would like to redirect them to a custom page here:

https://www.example.com/welcome

I have tried to 301 from / lists /? P = subscribe & id = 1 to / welcome, but it won't work. I guess it's because of the characters after / lists /.

And, I can't 301 from / lists to / welcome because / lists is also the first part of the unsubscribe page.

Is there a way to 301 from the full address above with REGEX? Or is there another way to get people to a custom page – without changing the PHP code base?

Thank you!

## regex – change nginx http headers

we are trying to migrate from apache to nginx, and we have a configuration where the proxy server receives an http header, modifies it and forwards it to the backend. This can easily be done with apache as follows:

``````                Header edit* Custom_Header  "(String_To_Replace)" "Replacement"
``````

However, I can't find any way to use regex in the nginx configuration. Ideas?

Thank you

## regex – Optimizing a bash script

I have a bash script that checks for updates for Gentoo.

``````#! /bin/bash
emerge --sync &> /dev/null
echo "\$(emerge --pretend   -avuDN --with-bdeps y world | grep "Total" | awk '{print \$2}' | tail -1)"
``````

I don't want to have an exit in the `stderr` and `stdout` stream, so when running this script, I need to redirect its output to a log file, then read the end of the file to print the expected number of updates. This is the command I am invoking.

``````./polyupdatemodule.sh &> log  && tail -1 log
``````

Is there a way to get the same result without using an intermediate permanent log file? Can I use a temporary file? If yes, how?

And in general, how can I improve this script?

## windows 10 – Regex: search for lines with a specific TAG that contains words starting with lowercase letters

I want to find these lines with a particular TAG which contains at least 2 words starting with lowercase letters. for example

`I love my house` (this kind)

and not

`I Love My House`

I'm trying a regex, but not too good:

FIND: `(?:G(?!^)|)s*K(*)|u\$1L\$2`

Maybe you can help me.

## Regex command to replace in the database

Hi guys

I have been here for over a decade as a reader. I guess I am finally stumped and I need help.

So, I have had a vbulletin forum for 17 years and now I have imported it into Xenforo. Everything was fine.

The problem is; I have 1.5 mil posts and 22k of these contain links from different places in the forum.

Basically, go here for links when someone in the past has pasted a link directing something to find something.

If someone reads the old messages and clicks on a link, page 404 will not be found.

These links must be modified in Xenforo format

Coded:

```Old Vbulletin4

New Xenforo2

If only I could somehow remove the thread label on the old vb4 links

-Beta-TEAM-checklist

Then after that, I can just use a simple SQL update query to fix the rest.

So, I have 22k links in the post table, all with different IDs and labels.

Each label begins with a hyphen –

If someone is nice enough, help me write a regex or complex sql command that will remove all end tags that come after the thread ID.

The thread ID and labels will be different from one link to the other, of course.

The only consistency is the dash – before the label and the backslash after the label. The backslash is only visible in the data table.

Here is an exact copy and paste of the above link example copied from the SQL table, the end backslash may be useful

Coded:

`[URL="https://www.domain.com/forums/showthread.php?55019-BETA-TEAM-checklist"]`

Centos7 / mysql57

db table: xf_post
db index: message

Thanks to everyone who helps

## django – Problems with Regex

The problem is that in your string, there are characters in square brackets which are special characters in the regular expression as you can see here in the documentation.

To resolve this issue, you must remove these brackets from your chain or use model the character before the square brackets, to indicate to the regex that it should not be considered a special character. See the example below:

``````string = "(Ticket: 20021501280806)"
re.findall(r'(Ticket: (d+))', string)
``````