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

  • Home
  • SEARCH
  • 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
Have a painfully simple blog Post creator, and I'm trying to check if the
I have a widget: http://designer-depot.com/prob/ When clicking to tab2, the image is not visible.
This is prob more of a geometry question, but I have an array of
I have made a start to create some training and test sets using 10
prob silly question: I have a list of 10 emails on the page and
I have a txt file named prob which contains: 6 2 8 3 4
I still have the force shutdown prob when i run the emulator.What have i
I have been trying to port my C++ based mass data transport protocol project
hi guys i have a weird prob here.. i have this dropdownlist where different

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.