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 6757249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:37:25+00:00 2026-05-26T13:37:25+00:00

I am new to regular expressions and I am trying to implement the metaphone

  • 0

I am new to regular expressions and I am trying to implement the metaphone algorithm in vb.net. http://en.wikipedia.org/wiki/Metaphone

The algorithm has lots of steps to replace characters depending on certain conditions. (ex. replace w unless followed by a vowel). Is there a way to handle branching logic using regular expressions?

I tried

 output = Regex.Replace(input, "w[^aeiou]", "")

but this removed the characters after the w too. input=wewl –> output=we (the goal is wel)

I could loop through the characters in the string to solve this problem, but I want to try to do this properly/most efficiently instead of just cranking out baggy code.

  • 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-26T13:37:26+00:00Added an answer on May 26, 2026 at 1:37 pm

    Your example could be solved by using

     output = Regex.Replace(input, "w([^aeiou])", "$1")
    

    I can’t tell you if that’s the most efficient way, but looking at the Wikipedia page of the replacements, working like this should work.

    Explanation: the round brackets define a group and the backreferences $1-$9 allow you to use the partial match in the replacement. You can get more information about backreferences on http://www.regular-expressions.info/brackets.html

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

Sidebar

Related Questions

I am completely new to regular expressions ,and I am trying to create a
I'm new to regular expressions and grep, but I've been trying to learn it
I'm new to regular expressions, but I'm trying to learn about it. I want
I'm quite new to regular expressions and I'm trying to create a regex for
I'm currently trying to use regular expressions in C#: Regex reg_gameinfo = new Regex(@PokerStars
I'm new to regular expressions and would appreciate your help. I'm trying to put
I am completely new to writing regular expressions. I am trying to write a
Hi I'm new to Ruby and regular expressions. I'm trying to use a regular
I'm new to regular expressions and am trying to find a string using preg_match,
I am new to ruby and regular expressions and trying to figure out how

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.