Jump to content

Regex problem..


Recommended Posts

Example:

9980767614,8NWZNbd3

1418650724,qlyitjie

28547211,gjipmcno

248872383,nbqnuavc

6688785775,agsyktqq >>>if this return false..

6688785775 >>if this return true

I want to check the numbers only which has 6-12 digits in the txt file..(no other things only 6-12 digits numbers)

If yes, return true..

else return false..

Thanks for replying..

Regard

Edited by Underdogger
Link to comment
Share on other sites

Just to be clear... you want to read the file (which includes all of those lines) and if even one line in the file has a line with JUST numbers, you want it to return true?

Do you mean you want it to return those numbers from the function?

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Just to be clear... you want to read the file (which includes all of those lines) and if even one line in the file has a line with JUST numbers, you want it to return true?

Do you mean you want it to return those numbers from the function?

Just to judge if "only" 6-12 digits numbers in the text file..

if something isn't number or something else will be return false..

When I set "d{6,12}" in expression in this example..

1418650724,qlyitjie

it will be return true..

but I want to judge only the 6-12 digits numbers in the file.

Link to comment
Share on other sites

If StringRegExp($str, "^\d{6,12}$") Then
    ; string is only 6-12 digits
Else
    ; something else
EndIf

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...