Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:45:40+00:00 2026-05-16T05:45:40+00:00

I have a prob. I’m trying to create a custom slugify functiom. I use

  • 0

I have a prob. I’m trying to create a custom slugify functiom. I use django.autoslug. Due to autoslug documentation I was able to create a custom slugifier, but it needs to be improved and I do not know how do I realize that.

So I have a string (book title) i.e. .NET Framework 4.0 with C# & VB in VisualStudio 2010. I want to slugify it so that it looks like this: dotnet-framework-4point0-with-cshapr-and-vb-in-visualstudio-2010

My current function looks like this:

def custom_slug(value, *args, **kwargs):
    associations_dict = {'#':'sharp', '.':'dot', '&':'and'}
    for searcg_char in associations_dict.keys():
       if search_char in value:
          value = value.replace(search_char, associations_dict[search_char])
    return def_slugify(value)

As you can see, my function replaces all dots . with 'dot'. So my string will be changed into dotnet-framework-4dot0-with-csharp-and-vb-in-visualstudio-2010

I suggest, I should use RegEx, but I don’t know how to do this and how do I replace matched string with right ‘dot/point-replacement’

Ideas ?!

P.S. Sorry for bad English

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:45:41+00:00Added an answer on May 16, 2026 at 5:45 am
    import re
    point = re.compile( r"(?<=\d)\.(?=\d)" )
    point.sub( value, "point" )
    

    to change the . s that should be "point" , and then do str.replace to change the others.

    Explanation

    point matches a . which is sandwiched between two digits.

    (?<=spam)ham(?=eggs) is a (positive) lookaround. It means "match ham, as long as it is preceded by spam and followed by eggs". In other words, it tells the regex engine to "look around" the pattern that it is matching.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My prob in brief: I have two tables namely category and product. table: category
I have a widget: http://designer-depot.com/prob/ When clicking to tab2, the image is not visible.
I got a prob that, I have a base static library Base, then other
I have a snippet to create a 'Like' button for our news site: <iframe
I have a shared Queue that I use to dump various messages contained in
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.