Sponsored Content
Top Forums UNIX for Dummies Questions & Answers All combinations from simple regex Post 302812101 by Don Cragun on Saturday 25th of May 2013 02:36:08 AM
Old 05-25-2013
There are 127 ** 4 + 127 ** 3 combinations of three or four characters for ASCII, 255 ** 4 + 255 ** 3 combinations of three or four characters for EBCDIC and ISO-8859-* code sets, and (several thousand) ** 4 + (several thousand) ** 3 combinations of three or four characters for Unicode. Of those, 4 + 4 * (number of distinct characters in your current locale's LC_CTYPE definition - 1) strings containing three or four characters will match your RE match your RE when your RE does not contain the anchors: "ace", "ace" preceded by any character except NUL, "ace" followed by any character except NUL, "bce", "bce" preceded by any character except NUL, "bce" followed by any character except NUL, "acde", and "bcde".

When your RE includes the anchors, only two out of (number of characters in your code set - 1) ** 3 three character combinations will be matched by your RE: "ace" and "bce"; and only two out of (number of characters in your code set - 1) ** 4 four character combinations will be matched by your RE: "acde" and "bcde".

In both cases the number of strings consisting of combinations of three or four characters depends on the code set underlying the locale you're using; not on the RE you use to match those strings.
These 2 Users Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Combinations

Hello All, i have two files, one of the format A 123 B 124 C 234 D 345 And the other A 678 B 789 C 689 D 567 I would like to combine them into one file with three columns: A 123 678 B 124 789 C 234 689 (4 Replies)
Discussion started by: Khoomfire
4 Replies

2. Shell Programming and Scripting

A simple find and replace without using any regex (bash)

Hi, I need to do an exact find and replace (I don't want to use regular expressions because the input comes from user). I want to find a line that matches the user's input text and replace it with an empty string. For example, let's say the user enters I love "Unix" and the contents of the... (2 Replies)
Discussion started by: srikanths
2 Replies

3. Shell Programming and Scripting

Need Help with Simple Regex

I have got a question. How to do this? I mean AND expression in regex. List all the files in current directory that do not contain the words use AND take. Thx.:p (15 Replies)
Discussion started by: evilfreakz
15 Replies

4. Shell Programming and Scripting

Simple regex problem?

Hi all, I am looking to create words from a sentence which adhere to a custom search pattern from my website: Example: ! +! / += ~ where the terms ! = not, +! = AND NOT, += - and equals and ~ = can be like.... Now here is the issue...i want to split a sentence like the one above on... (1 Reply)
Discussion started by: muay_tb
1 Replies

5. Shell Programming and Scripting

Help with simple RegEx on grep

Hello, I am trying to grep my log files for ORA errors, except ORA-00001. I have tried: grep 'ORA*!(-00001)' *.log but it is not working. Any help will be much appreciated. Thank you. (5 Replies)
Discussion started by: drbiloukos
5 Replies

6. Shell Programming and Scripting

help with simple regex expression

I am trying to grep the following line in a file using a bash shell: (..) admin1::14959:::::: (..) It works with the following expression (as expected) # cat file | grep ^*:: admin1::14959:::::: but it does not work with (not expected) # cat /etc/shadow | grep ^+:: I assume the... (2 Replies)
Discussion started by: schms
2 Replies

7. Shell Programming and Scripting

Combinations / Permutations

Hello Scrutinizer / Group , The shell script of awk that Scrutinizer made calculate all possible permutations in this case 3125 (5 numbers) but i want to have only the 126 possible combination. For now it does not matter the specific order of the combination numbers. I would appreciate it you... (1 Reply)
Discussion started by: csierra
1 Replies

8. Shell Programming and Scripting

All possible combinations

Hi, I have an input file like this a b c d I want to print all possible combinations between these records in the following way aVSb aVSc aVSd bVSc bVSd cVSd VS indicates versus. All thoughts are appreciated. (5 Replies)
Discussion started by: jacobs.smith
5 Replies

9. Shell Programming and Scripting

All possible combinations problem

Post #2 is the original post. This is the first answer to post #2 Hi, try: awk ' { match($0,/1+/) b=substr($0,1,RSTART-1) e=substr($0,RSTART+RLENGTH,length) for(i=2^RLENGTH-2; i>0; i--) { s=x; d=i while(d) { s=(d%2==0?0:1) s ... (12 Replies)
Discussion started by: Scrutinizer
12 Replies

10. Shell Programming and Scripting

Sendmail K command regex: adding exclusion/negative lookahead to regex -a@MATCH

I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works: LOCAL_CONFIG # Kcheckaddress regex -a@MATCH +<@+?\.++?\.(us|info|to|br|bid|cn|ru) LOCAL_RULESETS SLocal_check_mail # check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies
ace-of-penguins(6)						   User Commands						ace-of-penguins(6)

NAME
ace-of_penguins - Solitaire-games with penguin-look SYNOPSIS
ace-canfield ace-freecell ace-golf ace-mastermind ace-merlin ace-minesweeper ace-pegged ace-solitaire ace-spider ace-taipei ace-taipedit ace-thornq OPTIONS
None. DESCRIPTION
From the author's intro.html: "The Ace of Penguins is a set of Unix/X solitaire games based on the ones available for Windows(tm) but with a number of enhancements that make my wife like my versions better :-)" ace-canfield Solitary card-game ace-freecell Solitary card-game ace-spider Solitary card-game ace-solitaire Solitary card-game ace-thornq Solitary card-game ace-golf Another solitary card-game ace-mastermind Guess a secret combination of colors. ace-merlin Classical puzzle, rather frustrating. ace-minesweeper Find all hidden mines in a minefield. ace-pegged Classical board game. ace-taipei Asian puzzle, remove pairs of equal stones. ace-taipedit Editor for your own ace-taipei levels. KEYS
All games use the same library of functions and thus the same keys: F1 Online help. Esc Esc or "Q" to leave the game. NOTES
The upstream author DJ Delorie has written an informative webpage which is installed in /usr/share/doc/ace-of-penguins/intro.html The original binaries were renamed to include prefix ace-* to avoid name clashes. BUGS
If you encounter any bugs in this package, please report them to the Debian Bug Tracking System at http://bugs.debian.org/. ENVIRONMENT
None. FILES
None. SEE ALSO
Other games in /usr/games AUTHORS
Programs are by DJ Delorie, some by Martin Thornquist. This manual page was written 1999-09-09 by Thimo Neubauer <thimo@debian.org> for the Debian GNU system (but may be used by others). Updated 2007-09-03 by Jari Aalto <jari.aalto@cante.net>. Released under license GPL v2 or (at your option) any later version. ace-of-penguins 2012-03-23 ace-of-penguins(6)
All times are GMT -4. The time now is 10:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy