all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* NON-trivial regular expression problem (could not find on google)
@ 2003-01-18 20:19 Instant Democracy
  2003-01-18 21:38 ` Harry Putnam
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Instant Democracy @ 2003-01-18 20:19 UTC (permalink / raw)


Regular expression facilities are slightly varied in
sed
awk
lisp
emacs-lisp
Therefore these newsgroups can all contribute to the discussion.

A frequent problem involves simplifying a pathname. The string format we
can expect to encounter is covered by the following three examples:

"dir.name/../dir/../file"
"dir/../d2/../file.ext"
"d1/d2/../../file.ext"

The "" are part of the string, and not just string delimiters. These
strings are inside regular text on the line. The paths are never
absolute so that you will not encounter "/d1/file.ext".

The task is to eliminate patterns such as 
    DIRNAME/../
from the path because they are redundant.

For lines which do not have ../.. in them, this is
trivial, for example by regexp in sed, emacs etc.

The real problem is constructing a regular expression for
the DIRNAME before the /..

This DIRNAME can be described as a string that contains neither
/ not double-dot but anything else. Perhaps I am overlooking
something else about DIRNAME.

The regular expression for the first two cases is demonstrated by this
sed script although the lisp variants are identical.

sed 's,\(^.*\)\(/\|"\)\([^/][^/]*/\.\./\)\(.*"\),\1\2\4,'

The regex I use for DIRNAME is [^/]+ written above using * because
sed is without plus.

I will follow all the cross-posted newsgroups. If you prefer, because
some people are allergic to any cross-posting, you can post your reply
in just one of the groups pertaining to your application, ie lisp/elisp/sed/awk.

democrat

sigfile - you are welcome to use it or modify without changing its thrust.
>
> US DEMONCRACY IS FLAWED - THE SOLUTION FOR TODAY IS HERE
> 
> THE ECONOMY CAN BE KICK-STARTED BY LAYING OFF THE
> POLITICIANS AND REDUCING THEIR SALARIES BY 60%
> 
> What do we have today? A faulty plutocracy that was
> designed in an age that had no electricity, no
> electronics, no internet and no mass media. It was in a
> barbaric age of slavery and bigotry.  The people were so
> illiterate that they even failed to understand what they
> wrote in the constitution - otherwise there would be no
> slavery side by side with "... all men are created equal
> ...."
> 
> The reason for world-wide wars is corruption, and
> plutocracy. The power of criminal rulers is not being
> checked properly by that of the people.  There is too
> much effort to bring down a corrupt leader. For example,
> Clinton managed to lollypop a number of women before he
> was caught.  The child molesters in the church were not
> caught for a greater part of their life-time. But make
> no mistake, those who are caught are the unskilled
> ones. The highly skilled criminals like Bush and his ilk
> are not going to be caught in their life-time, so
> cleverly have they concealed their ill deeds.
> 
> The plutocrats are pathetic. The senators, congressmen
> and presidents failed to eliminate slavery and there is
> no justification to pay them high salaries to the tune
> of $500,000 per year and then the retirements, perks,
> security.
> 
> It happened on the battle field because plutocrats would
> not allow people's wishes to be translated into action.
> 
> Today, we are way behind times.
> 
> There is no need for a president, electoral college,
> congressmen and senators.
> 
> What is needed are state messengers and clerks. The
> public would vote weekly by telephone from their home to
> an electronic computer. Enter their password and vote on
> an issue. All can be made secure by multiple redundancy
> and open source code and interpreter that can be run on
> any PC. All voting is to be open and everyone can check
> cheating. If our medical records are going to be open,
> it is but little that all voting on issues is open and
> everyone can check their own voting with confirmation.
> 
> Just as we are secure with our bank accounts and check
> our balance by phone, we can vote on issues.
> 
> All issues can be discussed by internet, phone, and so
> on to educate the public.
> 
> But the senators, congressmen and presidents are
> corrupt, unfaithful even to their wives, take too much
> money for salary for a work executed pathetically. Some
> president are doing affairs, others are moral quacks
> with basic errors in english grammar and also
> intellectual and personality wise, midgets.
> 
> This is an age of instant telephone referendum and
> instant democracy.
> 
> The power to wage war should neither belong to the
> president, nor to the congress, but to the people via
> instant referendum.
> 
> The electoral college is also a dinosaur. Americans are
> educated enough to decide who to choose as a referendum
> executioner, that is, the president.
> 
> This is not a third world country, with slavery, no
> electricity, no media, no railway, no steam engine, no
> satellites, no telephone that we must not have instant
> democracy.
> 
> What we have today is not democracy, but demoncracy of a
> few.
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-01-24 18:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-18 20:19 NON-trivial regular expression problem (could not find on google) Instant Democracy
2003-01-18 21:38 ` Harry Putnam
2003-01-18 21:46 ` Kai Großjohann
2003-01-18 22:52 ` AW
2003-01-18 23:03 ` Edi Weitz
2003-01-19  0:27 ` Larry Clapp
2003-01-19  0:36 ` Dr. Yuan Liu
2003-01-19  0:53 ` John W. Krahn
2003-01-19  1:05 ` William Park
2003-01-19 12:17 ` Peter J. Acklam
2003-01-19 19:26   ` Dr. Yuan Liu
2003-01-20  9:15     ` Peter J. Acklam
2003-01-24 18:56       ` Yuan Liu
2003-01-24 11:20 ` Bruce Barnett

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.