PHP - replace the slash (/) with hyphen (-)

I started to replace the spaces, special characters, etc. with dashes. However, I can't find the proper way to replace a slash with a dash. I looked everywhere on the internet, some people, which suggests using the .htaccess file but I do not think that that suits my purpose. My code so far:

Example: You have 1 new message (07/12/2016)

I want to be: you-ve-got-1-new-message-12-07-2016

<? PHP

$message_original is $row_message ['title'];.

$message_lower = strtolower ($message_original);

$message_alpha = preg_replace ("/ [^ a - z0 - 9_\s-] /", "", $message_lower);

$message_dash = preg_replace ("/ [\s-] + /","", $message_alpha ");

$message = preg_replace ("/ [\s_] /", "-", $message_dash);

? >

$string = "you have 1 new message------$! (12-07 - 2016) « ;

$filtered = strtolower (preg_replace ('/ [\W\s\/] + / ', '-', $string));

echo $filtered;  you-ve-Got-1-New-message-12-07-2016

You can do it with the above simplified code. The regular expression "/ [\W\s\/] + / ' is a model group that contains three metacharacters:

  • \W matches any character that is not alphanumeric or underscore line (this is the same as [^ A-Za-z0-9_]).
  • \s matches any white space character.
  • ------/ corresponds to a forward slash.

Tags: Dreamweaver

Similar Questions

  • Can satellite M70-159 - I replace the motherboard with another?

    Hello!
    The model of the M70-159-card mother K000033840 can replace another motherboard with a number K000033860?

    Thank you.

    I put t know if it s possible because I m not a technician for laptop.
    Normally, you should only replace the motherboard with the same.

    I put t know if it works. Contact a local ASP and ask for a technician. They know where the other is, and if it would work.

  • Please replace the battery with the correct lenovo battery

    I have a Thinkpad L530 and bought a new battery and when I start it up I get this message (this battery installed is not supported by this system and will not charge.) Please replace the battery with the battery correct lenovo for this system

    buy a real battery. Press ESC to continue but the battery won't charge)

    I don't want to buy a new battery to another.

    I understand that this can be changed in the bios but don't know how.

    Now my battery is dead, and I'm unable to recharge it again.

    Ideas please


  • How to replace the paragraph with a space mark

    Hello

    I received the contents of a manual in raster format, but each line of text ends with a paragraph mark. How to replace the paragraph with a mark space otherwise than by hand?

    In Word, this is pretty easy, but I don't see not any provision for it in the search box on 7.2 Frame.

    Yours,

    Michael F

    ========

    \p = end of paragraph

    \P = beginning of paragraph

    See: Help > keyboard shortcuts > keys for the search and replace

  • replace the characters with accent with their basic letter

    Hello

    I need to replace the characters with an accent with their basic letter

    a = > has
    n = > n

    I use classes of equivalence as [[= n =]] in regexp_replace, but then I need to call it for each letter. Is there a simpler way?

    Concerning
    Marcus

    Given that I only have the names to convert INITCAP

    It seems that you can use the binary case-insensitive or accent sorting to get the results you want so:

    SQL> with t as (
     select 'ñÉäßÑéàâ' str from dual
    )
    --
    --
    select str, utl_raw.cast_to_varchar2((nlssort(str, 'nls_sort=binary_ai'))) str2 from t
    /
    STR      STR2
    -------- ---------------
    ñÉäßÑéàâ neassneaa
    1 row selected.
    
  • Replace the spaces with a sign +.

    Hello

    On of my items, I have a text... I want to replace the spaces with a plus (+) sign... something linke this


    Select
    text_field,
    Function_replace (text_field, "", "+") new_field
    Of
    table_A

    Like this?

    select regexp_replace('Please replace, me','[ ,-]+','+') replaced_txt from dual;
    
    REPLACED_TXT
    -----------------
    Please+replace+me
    
    Elapsed: 00:00:00.00
    

    HTH,
    Prazy

  • Replace the text with formatting

    I need to replace every occurrence of the word with impatience! with forward! in italics. I have not found a way to do... Any ideas?

    Thank you

    JackL

    Captivate 7 - Windows 7

    I have the answer for those who are interested. Captivate (7) lets you export captions and subtitles to Word. Once in Word, simply replace the text sought by the text in the layout you want, save, and then re-import the Captivate projects. Works perfectly, with a caveat. If you use bullets (standard or numbers), the hyphen and the bullet formatting to these legends may require some manual adjustments after importation.

    In any case, this process has saved me a lot, a lot, a lot of hours!

    Jack Loganbill

  • How to replace the iPhone with iCloud contacts contacts

    I see a lot on the other hand... but I need help.  I spent hours on my reductive duplicates of MAC (2-3 each) and out Hung old addresses, etc..  I've narrowed my list of contacts from 1200 to 458.  Once I did, I have archived my new list of contacts "just in case."  When I go in iCloud on my computer, I see 458 contacts.  Large.  However, my iPad and iPhone are always a mess.  I thought that this was happening in iCloud would replace the junk on my devices.  I have read articles that said disable contacts in iCloud and it will ask you what you want to do with contacts - delete.  Yes, I did.  It has eliminated about 90 contacts and that's it.  Also, I went to all my e-mail and accounts disabled using contacts from gmail, yahoo, outlook etc.  Who does nothing either.

    Summary: What's in my account iCloud, 458 contacts, is correct.  Now, how the hell do I clean my iphone and ipad and load these 458 contacting them and get rid of the 1200-1500 in each device now?  Waaaah.   Very frustrating that there is not a global deletion that I can find.

    Please help a rookie.  MM

    Turn on the iCloud contacts for all devices

  • Guide: replace the HDD with SSD, Lenovo Y480

    Lenovo
    That's how I replaced my HDD with a SSD in my Lenovo Y480. I did it immediately, so there is no user file to consider. I used a key from Lenovo recovery. Read this guide in its entirety before starting.

    Execution time: about an hour.

    Items, you will need:

    -Y480 Lenovo

    -New SSD (I chose a Mushkin Chronos Deluxe because my research lead me to conclude that it is the best available from June 2012)

    -Small Phillips screwdriver

    -Butter knife or similar to remove the HARD drive. There is not much space for your fingers in there.

    -DVD-r blank

    Step 1

    Turn on the computer.

    Step 2

    Write the number '1' on a blank DVD-R and insert into the optical drive.

    Step 3

    Press the small button just to the right of the power button. This launches a recovery key.

    Step 4

    Follow the instructions on the screen to make restore disks. I chose the factory restore option, which required three DVD - Rs. label each disc with numbers to let you know in what order to use them later. Once it is finished, place back #1 DVD into the optical drive.

    Step 5

    Physically remove the hard drive and insert the SSD drive by following the instructions below.

    1. turn off and unplug your computer, flip upside down.
    2. remove the battery.
    3. remove the access panel by removing the two screws and slide.
    4. remove the two screws that hold the hard drive carrier.
    5 remove the hard drive by lifting upward. There is a right angle SATA adapter plugged into the hard drive. This card just came out with the hard drive.
    6 disconnect the hard drive adapter and plug it on the SSD.
    7 unscrew the hard drive bracket and screw it on the SSD.
    8 put the SSD drive in the Bay, screw the support down and replace the access panel. Be sure to screw it up.
    9. replace the battery, lock.

    Step 6

    If you did not already the first recovery DVD in the optical drive, use a paper clip to open the optical drive and insert the diskette. Close the drawer, then turn on the computer to start the restoration.

    Step 7

    Select the boot drive by pressing F12 when you see the Lenovo logo during startup, and then select the optical/DVD drive in the list.

    Step 8

    Follow the instructions on the screen. The first time that I did, restoration impossible immediately, probably because of a missing partition. However, after restarting the computer by performing a battery pull, then continue to step 6 restore completed successfully.

    I have not compared this drive, but I can tell you that the Windows experience index is 7.9 and startup time is 24 seconds now. The base index is 6.8 for this system now.

    You will find that Windows has already helped TRIM. However, regular defragmentattion was still on. I think that the system restore has been disabled automatically.

    Good luck

    Matt

    I saw no option for this, and I was quite surprised, that he didn't do it automatically. I'm not an expert on everything, so what follows is a guess.

    Perhaps that if you create a partition on the SSD first, recovery will recognize and use it.

  • Model: G6-1D98DX, refurbished: renovated pavilion laptop g6, replace the fan with what?

    When I powered my laptop Pavilion G6 refurbished, it gives a disturbing message on the fan turns not and the processor of cooking and automacially stops in 15 seconds. OK, replace the fan.

    By the? appropriate? HP 'Maintenance and Service of Guide' (Doc PN 649111-002), I took part BUT Guide HP, the processor heat sink is held by 7 screws... only it renovated its heatsink is a model of 4 screws, and the motherboard was ever available for 7 screws.
    How to order the appropriate and/or fan-with-heat sink fan? the fan-with-heat sink seems to be a unit

    use data created on the fan or radiator Assembly to try to find a part on google or ebay.

    http://www.eBay.com/ITM/new-OEM-HP-Pavilion-G6-G6-1000-series-cooling-fan-with-heatsink-641024-001-4-pin-/251637960612?hash=item3a96ca8fa4:g:dTsAAOSwq5lTmneN

  • If I replace the control with another why DAQmx create channel once complain a false claim?

    I tried to replace the frequency by another control in the example found here complete PWM:

    http://www.NI.com/white-paper/2991/en

    However, I get the following error message:

    Possible reasons:

    Requested value is not supported for this property value. The value of the property may be invalid because it is in conflict with another property.

    Property: CO. Pulse.Freq
    Required value: 0.000000
    Valid values begin with: 22.300000e - 309
    Valid values ending with: 20.0e6

    Channel name: Dev1/ctr0

    Task name: _unnamedTask<10>

    My wiring diagram looks like this:

    If I cancel my change (i.e. I have remove the frequency control knob and turn it over to the control of the example, it works perfectly.)  I get the waveform is displayed in the oscilloscope.

    My goal is to simply use a frequency and duty cycle control knob.  How can I achieve this?

    There are two things to do.

    What I think you did now changes the scale of the handle.

    You will also need to change the values that are allowed to enter. You will do on the data entry tab in the dialog button properti.

    Uncheck the 'use default', the Minimum value limits and Maximum identical to your balance.

    Value "Response to value out of range" Coerce to both Minimum and Maximum.

    I hope this helps.
    Let me know if you have more problems.

  • My printer HP LaserJet 1536dnf printer prints black pages after replacing the toner with a new one!

    I changed the toner cartridge for my printer HP LaserJet 1536dnf with a genuine HP toner cartridge and now it's printing the pages in black.  Any suggestions on how to fix this?

    Thank you!

    Hi @Beaglemom49779,.

    I see by your post that you have replaced the toner and now get all black pages. I can help you with this.

    Have you had the same problem with the printer before replacing the toner?

    It could be a hardware or with the printer fuser problem.

    If the problem started just after replacing the toner then most likely, the toner.

    Make sure that the printer is connected directly to a wall outlet. (do not use a hub or a surge protector)

    Number one cause of problems with toner.

    Check if the drum unit for damage:

    1. remove the cartridge of toner product and check that the tape has been removed.
    2. check the memory chip for damage.
    3 examine the surface of the imaging drum on the bottom of the toner cartridge.
    CAUTION: Do not touch the roller (Imaging drum) on the bottom of the cartridge.

    His fingerprints on the imaging drum can cause print quality problems.
    4. If you see the scratches, fingerprints, black on the drum, or any other damage on the imaging drum, replace toner.
    5. If the imaging drum does not appear to be damaged, rock the toner cartridge gently several times and reinstall it. Print a few pages to see if the problem is resolved.

    Please call our technical support if the there is a problem with the toner and you learn about a replacement, to the 800-474-6836. If you do not live in the United States / Canada region, please click the link below to get help from your region number. Contact HP.

    Good day!
    Thank you.

  • is it possible to replace the wifi with another card?

    Hello

    I have a t400 with intel 5100 wifi card and now I want to install mac os on my laptop.

    problem is that mac os is not detecting the 5100 series of wifi card and I would like to know if it is possible to replace the current model 5100 with an old series?

    Is there any Center of service authorized in Uppsala in Sweden / Sweden for this?

    Thank you

    Limited wireless cards Lenovo Lenovo units certified to work with the brand machine. This is done through a white list in the system BIOS. Recently, I disassembled the last BIOS of T500/W500 (version 3.14 - 1: 06) and discovered the following picture of the white list. It's raw hex big endian joined with what I found by searching for the device ID's are redundant entries to change supplier codes.

    86803 B 428680111000 Intel Corporation PRO/Wireless 5350 AGN [Echo Peak] network connection

    86803D 428680111200 Corporation Intel WiMAX/WiFi Link 5150

    868036428680111000 Intel Corporation ultimate N WiFi Link 5300

    868037428680111200 Intel Corporation PRO/Wireless 5100 AGN [Shiloh] WIRELESS card

    868037428680161200 Intel Corporation PRO/Wireless 5100 AGN [Shiloh] WIRELESS card

    8C161C008C16350000 Atheros AR5007EG

    EC107281EC1020E000 Realtek RTL8191SEvB (yuck, Realtek!) I wouldn't want one of these...)

    86803 8086:423D 428680161200 Corporation Intel WiMAX/WiFi Link 5150 D

    8680840086801513 corporation Intel Centrino Wireless-N 1000

    Your T400 comes from the same range and has probably the same list. Don't forget, you can buy a Lenovo brand unit.

    Also look for a PM with additional information.

  • Replace the HDD with SSD boot disk and use the disk HARD now as secondary storage

    I would like to replace my dv7 - 6143cl HDD with a SSD boot drive and using the OEM HARD drive as secondary storage.

    I have the SSD and the caddy

    I need to:

    delete the original OEM HD

    Install the SSD

    install OEM HARD drive in secondary Bay

    Install Win 7 (I don't have install disks - what is on the HARD drive in his backup partition)

    or I have to

    delete this HD

    Install the SSD

    go into the BIOS, and then assign him drive in AHCI (etc.)

    Install Win 7

    install OEM HARD drive in secondary Bay

    etc.

    I want to dual-boot, if possible, but I think that the second HD (start-up disk) does not start, even if I change the settings in the BIOS

    is this true?

    Pavilion dv7 - 6143cl

    I7

    8Gb

    Win7 (64)

    Thank you very much

    Hello:

    Your BIOS is set to AHCI (or RAID) by default. It cannot be changed.  Look in your device manager and in the IDE ATA/ATAPI controllers section, look to see if there is a controller SATA ACHI he.

    If so, you have an AHCI BIOS default.

    If you go further down the line in Device Manager and see a section of storage controllers, click on that, you would see a SATA RAID controller and your BIOS is set to default RAID.

    I don't have your model laptop so I don't know if HP has implemented some models double disk RAID or AHCI.

    So... First, copy your original C:\ drive SWSetup folder and save that to a portable hard drive. That must contain all the files installation for the drivers and the software provided with your PC. You can search this folder for programs that you may want to reinstall after your new SSD drive HARD primary.

    To install W7 on your SSD, check your own install of W7 disc.  Here's how:

    If you can read the Microsoft windows 7 25-character product key, you can download simple Windows 7 ISO files to burn on a DVD for the version of windows that is installed on your PC, and which is listed on the Microsoft COA sticker on your PC case.

    Burn the ISO with the option to burn the ISO on your DVD burning program and burn it at the slowest possible speed that will allow your program. This will create a bootable DVD.

    Or use the installation of Windows 7 USB/DVD tool to compile the ISO file that you download from Digital River. Link and instructions below. You need a 4 GB flash drive to use the USB compilation method.

    http://www.microsoftstore.com/store/msstore/HTML/pbPage.Help_Win7_usbdvd_dwnTool

    Use 25 characters on the PC product key to activate the installation.

    The key will activate a 32 or 64 bit installation.

    Then go to the support of the PC and driver page to install the drivers you need.

    Link to downloads ISO of W7 is below.

    http://www.mydigitallife.info/official-Windows-7-SP1-ISO-from-Digital-River/

    Can't answer your question on the dual boot as I never did before.

    Paul

  • replace the HDD with SDDS in pavllion HP DV7

    I have laptop HP DV7. recently my hard drive creates a few (ratllle nosie) nosie and I rebooted my system again... I didn't ERROR no bootable device - insert boot disk and press any key...

    I have googled this error and understadn the hard drive died... am outside the warranty period. I decided to replace my HDD with SDS... I don't know if I can do it?

    I got tosibha MK6461GSYN HARD drive. I would like to replace with SDDS and reinstall the OS from another software...

    Hello

    There are two parts: hardware and software. For hardware, it will take 5 to 10 minutes, but for the software that can take several hours, days or even weeks. To shorten the task of software, my suggesion: order the recovery disks on HP and put your machine into factory settings. You can continue from there.

    http://support.HP.com/us-en/document/bph07143

    Have a good weekend and good luck.

Maybe you are looking for