Coder Social home page Coder Social logo

Comments (7)

ssborbis avatar ssborbis commented on August 15, 2024

I think you need to filter out all non letters and numbers, then replace spaces with hyphens

Something like...

/[^A-Za-z0-9]/ /g
/\s+/-/g

There's still an issue of a trailing hyphen, but that should get you close

from contextsearch-web-ext.

ssborbis avatar ssborbis commented on August 15, 2024

Oh, and change your template variable to %sl to get all lowercase

from contextsearch-web-ext.

MW-J97 avatar MW-J97 commented on August 15, 2024

/[^A-Za-z0-9]/ /g
/\s+/-/g

Oh, and change your template variable to %sl to get all lowercase

I think it works fine, thanks so much for help.

There's still an issue of a trailing hyphen, but that should get you close

Yes, there is a trailing one in the end of the search. Till now, it doesn't affect and I'll give it a try.
But if it's can be deleted, that'll be perfect.

from contextsearch-web-ext.

ssborbis avatar ssborbis commented on August 15, 2024

I think you could add a regex line /-$//g to remove an ending hyphen

from contextsearch-web-ext.

MW-J97 avatar MW-J97 commented on August 15, 2024

I think you could add a regex line /-$//g to remove an ending hyphen

No, I think it's not working.

from contextsearch-web-ext.

ssborbis avatar ssborbis commented on August 15, 2024

It's working for me using the test string you provided

/[^A-Za-z0-9]/ /g
/\s+/-/g
/-$//g

Ricky Rich & ARAM Mafia - Habibi (Official Audio) -> ricky-rich-aram-mafia-habibi-official-audio

from contextsearch-web-ext.

MW-J97 avatar MW-J97 commented on August 15, 2024

/[^A-Za-z0-9]/ /g
/\s+/-/g
/-$//g

I think it works now. Maybe I wrote it wrongly.
Thank you so much.

from contextsearch-web-ext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.