Re: Regular Expression




"John Gordon" <gordon@xxxxxxxxx> wrote in message
news:eitahe$it7$1@xxxxxxxxxxxxxxxxxxxx
In <1163012269.707590.302280@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> "Rahul"
<ravi.sgn@xxxxxxxxx> writes:

I need a regular expression..
The conditions are as follows...

1. There should not be any blank spaces.

^[^ ]*$

(Note that I interpreted "spaces" literally. If you also wanted to
exclude
other space-like characters such as tabs, you'll have to modify this
expression.)

2. Text may or may not contain slashes.

I'm not sure why this condition is even listed. It's okay to have
slashes,
but it's also okay not to have them. This condition is meaningless.

It depends on whether you think the conditions are inclusive or
exclusive (or additive versus subtractive, or implicit versus explicit,
whichever pair of terms you prefer). I.e. are we allowing all strings, as
long as they don't break any of the above conditions? Or are we not allowing
any strings, unless these conditions allow them? If it's the latter, the RE
might be more like:

^/*$

But yeah, condition 2 is a red flag telling me that the problem is not
well understood, and further clarification would help.

- Oliver


.



Relevant Pages

  • Re: Regular Expression
    ... other space-like characters such as tabs, you'll have to modify this ... but it's also okay not to have them. ...
    (comp.lang.java.programmer)
  • Re: Processing command line arguments
    ... original code) be a reasonable solution?: ... However this is the way round.argvcontains a list of strings. ... strings in place, though I think they are writeable for historical reasons, ... and it is a bad idea and may even be illegal to modify the pointers in theargvarray. ...
    (comp.lang.c)
  • Re: The Coalition against Personal Firewalls
    ... correct changes. ... You can modify the code as YOU like. ... It seems you don't know that modern compilers do a lot of optimization ... or strings. ...
    (comp.security.firewalls)
  • Re: Where can I change international system popup message contents?
    ... one can just modify the variable of IDS_CONFIRM_DEL_RECBIN from ... But it is only applicable to english os. ... like you would find the LOC_* strings in common.str. ... IDS_CONFIRM_DEL_RECBIN is local to the ceshui component. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Politer REPOST - RUNDLL Error - bridge.dll
    ... is it okay to delete or modify the RunDLL entry in the righthand pane ... I have navigated to the following key use the Registry Editor: ... In the righthand pane on the screen, there's an entry that looks like this: ...
    (microsoft.public.windowsxp.help_and_support)