473,321 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

match any character but

Can I use any reg exp(mainly for mod rewrite) where I can match any
character but a fixed list?

I need to match a string that does not contain any /'s but I don't want to
have to use a character search string. (I don't see any need to have to
hardcode it)

that is,

..

matches any single charactr

and (.*) matches any string

what I want to do is use something like % that means

..%/

which means match any character but /.

Of course it would need to be valid and I know I can't make up semantics for
the reg ex. My point is is that, is that I don't want to have to use
[a-z0-9\-%&^$#@!etc...] to mean . but not /.

Surely there is a way to exclude a few characters from . without having to
increase the complexity of the expression 1000 fold?

If you don't get that, then a simple example would be that I have an
arbitrary string and I want to match only if that string does not contain an
a. Sure I can so something like
[bcdefghijklmnopqrstuv1234567890!@#$%^&*()_+][';/.,<>?:"{}+-=~`..........................]
but surely reg exp has an easier way??? (again, this is specifically for mod
rewrite)
Thanks,
Jon
May 5 '07 #1
2 1699
..oO(Jon Slaughter)
>Can I use any reg exp(mainly for mod rewrite) where I can match any
character but a fixed list?
Use a character class with a leading ^ to negate it:

[^/]

Matches anything that is not a slash.

Micha
May 5 '07 #2

"Michael Fesser" <ne*****@gmx.dewrote in message
news:9b********************************@4ax.com...
.oO(Jon Slaughter)
>>Can I use any reg exp(mainly for mod rewrite) where I can match any
character but a fixed list?

Use a character class with a leading ^ to negate it:

[^/]

Matches anything that is not a slash.
Ok. Duh. wasn't putting 2 and 2 together. [^/] should match anything but a
slash. lol.

Thanks,
Jon
May 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Ravi | last post by:
Hi, I have about 200GB of data that I need to go through and extract the common first part of a line. Something like this. >>>a = "abcdefghijklmnopqrstuvwxyz" >>>b = "abcdefghijklmnopBHLHT"...
9
by: Ron Adam | last post by:
Is it possible to match a string to regular expression pattern instead of the other way around? For example, instead of finding a match within a string, I want to find out, (pass or fail), if...
3
by: bdwise | last post by:
I have this in my body tag: something();something(); document.thisForm.textBox1.focus();something(); And I want to find a part between the semicolons that ends in focus() and remove the...
2
by: Sriram | last post by:
Hi, I am having trouble matching a regex that combines a negated character class and an anchor ($). Basically, I want to match all strings that don't end in a digit. So I tried: ...
1
by: Venkat | last post by:
Hi, I am using match function of string to find if a character is there in a string. The function Match is working fine with all the other characters except when the searching character is "+"....
19
by: Tom Deco | last post by:
Hi, I'm trying to use a regular expression to match a string containing a # (basically i'm looking for #include ...) I don't seem to manage to write a regular expression that matches this. ...
3
by: jt | last post by:
Ref: I'm building a new character array (alerts.msg). I have a character array with a mix of binary and text characters with is "alertmsg". Some of the characters are a DLE (0x10) char that I...
2
by: brad | last post by:
Hello all, I'm new to javascript--not too new to a few other programming languages--and I need your help deciphering the Regexp in the following string. Regular expresions are hard enough in...
32
by: Licheng Fang | last post by:
Basically, the problem is this: 'do' Python's NFA regexp engine trys only the first option, and happily rests on that. There's another example: 'oneself' The Python regular expression...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.