Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Text replacement / URL save text

Featured Replies

Hi all,

I am trying to write a calculation to make a URL safe string from a field. By URL safe I mean only containing A-Z 0-9 _ and - .

I have a PHP script using regexp to do this on the web side but need to convert it to FM.

Requirements

-------------

Replace one or more spaces with a single "_"

Replace one or more & with "_and_"

Replace anything not A-Z 0-9 _ with "_" ([^_a-z0-9]+

I've been playing with the Substitute function but it appears I would have to do this individually for every character I dont want, and then check for double (triple, quad..) underscores.

Can anyone help with this.

Cheers

Matt

Edited by Guest

Sounds like a job for a custom function. Admittedly you will have to allow for all your parameters, but it will simplify the job.

Yes, you will have to use the Substitute function. I don't see any way to make it easier.

  • Author

Think I sorted it, not perfect but seems to work OK


Substitute ( 

  TrimAll ( 

    Filter ( 

      Lower ( text ); 

        "abcdefghijklmnopqrstuvwxyz _-" ); 1; 0); 

" "; "_")

:cofeebrake:

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.