4 8979
On Sat, 15 Jan 2005 14:59:18 -0500, Sugapablo <ru**@REMOVEsug apablo.com>
wrote: Does anyone have a handy-dandy function they can quickly post that strips everything from a string except for letters, numbers, & underscores?
$stripped = preg_replace('/[^a-z0-9_]/i','',$string);
--
* html {redirect-to: url(http://pornel.ldreams. net);}
*** Sugapablo escribió/wrote (Sat, 15 Jan 2005 14:59:18 -0500): Does anyone have a handy-dandy function they can quickly post that strips everything from a string except for letters, numbers, & underscores?
function strip_all_but_l etters_numbers_ and_underscores ($text){
return preg_replace('/[^\w\d_]+/', '', $text);
}
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--
"Alvaro G. Vicario" <kA************ *****@terra.es> wrote in message
news:1u******** *************** *****@40tude.ne t... *** Sugapablo escribió/wrote (Sat, 15 Jan 2005 14:59:18 -0500): Does anyone have a handy-dandy function they can quickly post that
strips everything from a string except for letters, numbers, & underscores? function strip_all_but_l etters_numbers_ and_underscores ($text){ return preg_replace('/[^\w\d_]+/', '', $text); }
-- -+ Álvaro G. Vicario - Burgos, Spain +- http://www.demogracia.com (la web de humor barnizada para la
intemperie) ++ Las dudas informáticas recibidas por correo irán directas a la papelera -+ I'm not a free help desk, please don't e-mail me your questions --
Eh, \w includes digits and the underscore. Also, capital letters are used to
denote "not a meta character." Hence the following:
preg_replace('/\W+/', '', $text);
*** Chung Leong escribió/wrote (Sat, 15 Jan 2005 23:07:33 -0500): Eh, \w includes digits and the underscore. Also, capital letters are used to denote "not a meta character." Hence the following:
preg_replace('/\W+/', '', $text);
Absolutely right. My code is what happens when you trust your memory :)
--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark |
last post by:
Hi,
Im trying to figure out how I can have data validated in a text input form.
Basically the data entered into the form must consist of 2 uppercase letters
followed by 5 non negative numbers with no spaces in between. I want it to
display an error message if the letters arent in uppercase & if any of the
numbers are negative. Ive figured...
|
by: Peter |
last post by:
Dear all,
Could you give me a hint?
a) I generate a report from a query table, then I want to use this
report
to show the total numbers of the customers who buy the goods. There is a
string field "choose goods" in the table. Such field only contains either
"1" or "". Therefore, I write the IIF function on the report form at the...
|
by: matt |
last post by:
Greetings:
I appoligize if I'm asking a question that's already been answered in
the group - I've scoured for about two hours and I can't find a
solution. I also appoligize if I over complicate my question, but I
want to be sure that I communicate my thought(s).
The database I'm working on will generate tens, perhaps hundreds of
thousands...
|
by: jimfortune |
last post by:
From:
http://groups-beta.google.com/group/comp.databases.ms-access/msg/769e67e3d0f97a90?hl=en&
Errata:
19 solar years = 2939.6018 days should be
19 solar years = 6939.6018 days
Easter Function explanation Part II
|
by: deko |
last post by:
I need to loop through a string and remove all characters except numbers or
letters. I am getting an ArgumentOutOfRangeException: "Index was out of
range. Must be non-negative and less than the size of the collection"
Not sure what is going on... any suggestions welcome!
public static string fixStr(string aStr)
{
StringBuilder bStr =...
| |
by: mark |
last post by:
I have a table of UK companies whose records I want to filter using a
map of postcode regions.
For the benfit of people outside the UK, our postcodes are a pain to
work with because they are not a standard length, and the part which
identifies the region isn't a standard length either.
The first letters of the postcode denotes a general...
|
by: idoerg |
last post by:
Hi all,
I am running Python 2.5 on Feisty Ubuntu. I came across some code that
is substantially slower when in a method than in a function.
################# START SOURCE #############
# The function
def readgenome(filehandle):
s = ''
|
by: Serman D. |
last post by:
Background: The Payment Card Industry (PCI) Data Security Standard
(PCI DSS) is a standard for financial institutions. It requires
sensitive information, such as credit card numbers, to be "unreadable
anywhere it is stored" using hashing, truncation or encryption.
I am looking for a simple truncation function that replaces the last
four...
|
by: Thekid |
last post by:
I had made a post about making a loop using letters instead of numbers and dshimer gave me this solution:
for i in range(65,70):
for j in range(65,70):
for k in range(65,70):
print chr(i),chr(j),chr(k)
which used an example I had posted using numbers. That code works (thanks dshimer) but after toying with it I see...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| | |