Visit Our UNIX and Linux User Community


PCRE string questions.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting PCRE string questions.
# 1  
Old 10-19-2009
PCRE string questions.

What is the string that would satisfy this expression: "^gs{3}$" ?

What is an expression that would satisfy all these strings: csafaq.exe, csafbc.exe, asdfcd.exe?

Also, To catch these files, :
gdnus1862[2].exe
gdnus10[1].exe
gdnus250[1].exe
gdnus2337[1].exe

I am using this regex. : ^gdnus[0,9]{1,5}.[0,9]{0,1}.\.exe$

But it is not working. What is wrong with it?

Your help is appreciated, thanks. Smilie
# 2  
Old 10-19-2009
Code:
1. gsss
2. ^......\....$ or ^.s.f..\.exe$ or ^[ca]s[ad]f[abc][qcd]\.exe$
3  Use [0-9] instead of [0,9]


Last edited by Scrutinizer; 10-19-2009 at 05:23 PM..
# 3  
Old 10-19-2009
Awesome thank you...

Previous Thread | Next Thread
Test Your Knowledge in Computers #824
Difficulty: Medium
HTML 5 specifies scripting application programming interfaces (APIs) that can be used with JavaScript.
True or False?

4 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Postfix - pcre

Hello. I need to test valid sender address. I have created a rule in main.cf : smtpd_sender_login_maps = pcre:/etc/postfix/sender_login_maps.pcre smtpd_sender_restrictions = reject_non_fqdn_sender, reject_unknown_sender_domain, reject_sender_login_mismatch THe file... (1 Reply)
Discussion started by: jcdole
1 Replies

2. Shell Programming and Scripting

PCRE negative lookahead

I have read many tutorials and cannot get this to work. I need to use pcre (because that is what the library in the software we are using uses) and pcregrep everything except /home from the /etc/fstab pcregrep '(?!/home)' /etc/fstab It returns the entire fstab (This is on a RHEL5... (1 Reply)
Discussion started by: insania
1 Replies

3. Programming

messy questions: how to convert a string into a int64 in linux

Recently I was stuck at 64bit questions in 32pc....... lots of unknown questions came up .... as mentioned : messy questions: how to convert a string into a int64 in linux i tried ll = atoll(string) but faild btw: ll is defined as : long long ll = 0; I print the return like this:... (2 Replies)
Discussion started by: macroideal
2 Replies

4. Shell Programming and Scripting

...yet another string of awk/sed questions from a RegExp-Challenged luser %-\

Greetings all, ...here is yet another string of awk/sed questions from a RegExp-Challenged luser :eek: I'm looking to have sed/awk do some clean-up on routing tables and to that end, I would like to do the following: 1.) If a line contains the word "masks" or "subnets" prepend CR/LF to... (16 Replies)
Discussion started by: SteveB-in-LV
16 Replies

Featured Tech Videos