This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

(Regexp) i need help making a case-insensitive pattern :(

Old posts that have not been replied to for several years.
Locked
C
Caribou
Voice
Posts: 28
Joined: Thu Apr 15, 2004 12:51 pm
Location: France

(Regexp) i need help making a case-insensitive pattern :(

Post by Caribou »

Hello,

i wanna make a pattern who is not checking for majs, i mean a non-casesensitive or case-insensitive

thats mean in a string like "HeLLO" pattern "hEllO" will not work... i wanna make it working.. matching it, majs doesn't matter :(

in mIRC scripting you have to use //i .. pattern becoming "/hEllO/i" but on TCL its not working by this way ..

Were reading help file about Regexp, i think its a Metasyntax, but i don't know how can i use it, they are not giving any example, and i can't understand a word... great help .. lol

Someone got any clue on how i can make a pattern non-casesensitive ?

Thanks for any help !


Help Thread :

METASYNTAX
In addition to the main syntax described above, there are some special forms and miscellaneous syntactic facilities available.

Normally the flavor of RE being used is specified by application-dependent means. However, this can be overridden by a director. If an RE of any flavor begins with `***:', the rest of the RE is an ARE. If an RE of any flavor begins with `***=', the rest of the RE is taken to be a literal string, with all characters considered ordinary characters.

An ARE may begin with embedded options: a sequence (?xyz) (where xyz is one or more alphabetic characters) specifies options affecting the rest of the RE. These supplement, and can override, any options specified by the application. The available option letters are:

b
rest of RE is a BRE
c
case-sensitive matching (usual default)
e
rest of RE is an ERE
i
case-insensitive matching (see MATCHING, below)

m
historical synonym for n
n
newline-sensitive matching (see MATCHING, below)
p
partial newline-sensitive matching (see MATCHING, below)
q
rest of RE is a literal (``quoted'') string, all ordinary characters
s
non-newline-sensitive matching (usual default)
t
tight syntax (usual default; see below)
w
inverse partial newline-sensitive (``weird'') matching (see MATCHING, below)
x
expanded syntax (see below)
Embedded options take effect at the ) terminating the sequence. They are available only at the start of an ARE, and may not be used later within it.

In addition to the usual (tight) RE syntax, in which all characters are significant, there is an expanded syntax, available in all flavors of RE with the -expanded switch, or in AREs with the embedded x option. In the expanded syntax, white-space characters are ignored and all characters between a # and the following newline (or the end of the RE) are ignored, permitting paragraphing and commenting a complex RE. There are three exceptions to that basic rule:

a white-space character or `#' preceded by `\' is retained

white space or `#' within a bracket expression is retained

white space and comments are illegal within multi-character symbols like the ARE `(?:' or the BRE `\('

Expanded-syntax white-space characters are blank, tab, newline, and any character that belongs to the space character class.

Finally, in an ARE, outside bracket expressions, the sequence `(?#ttt)' (where ttt is any text not containing a `)') is a comment, completely ignored. Again, this is not allowed between the characters of multi-character symbols like `(?:'. Such comments are more a historical artifact than a useful facility, and their use is deprecated; use the expanded syntax instead.

None of these metasyntax extensions is available if the application (or an initial ***= director) has specified that the user's input be treated as a literal string rather than as an RE.
C
Caribou
Voice
Posts: 28
Joined: Thu Apr 15, 2004 12:51 pm
Location: France

Post by Caribou »

well i used [string tolower ?string?] and [string tolower ?pattern?] to do it myself cause i were bored

But i still wanna whats the exact sentense needed in pattern to do this :-?

would be better i think :lol:
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Are you sure you need regexp? How about using the faster (but mode limited) string match?
An ARE may begin with embedded options: a sequence (?xyz) (where xyz is one or more alphabetic characters) specifies options affecting the rest of the RE. These supplement, and can override, any options specified by the application. The available option letters are: ...

Code: Select all

regexp "(?i)hello" hElLo
Also, check http://tcl.tk//man/tcl8.5/TclCmd/regexp.htm#M11
Have you ever read "The Manual"?
C
Caribou
Voice
Posts: 28
Joined: Thu Apr 15, 2004 12:51 pm
Location: France

Post by Caribou »

well no im not sure, im a beginner, but thats the only way i found to find what i need, cause my using a list

Im using a list, to store data, by nickname, something like this nickname:data1:data2

when i got many nicknames stored, the only way i find out was an lsearch with -regexp option to get it, with a pattern like "$nick:." it will return to me the position on the list, then with lindex i can return the data stored for this nickname.

i know wildcard would be better, regexp are usefull only with hard research

but i experimented few problems, with egghelp.org forum community i resolved this thing, i have to thank you all for helps you are giving for newbie like me.

i don't know if list its the fastest and best way to store and use data, data will never huge cause its a "temporaly" storage.

and sorry again for my weird english learned on internet :lol:
Locked