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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:10:41+00:00 2026-06-11T07:10:41+00:00

First of all, regular expressions are quite possibly the most confusing thing I have

  • 0

First of all, regular expressions are quite possibly the most confusing thing I have every dealt with – with that being said I cannot believe how efficient they can make ones life.

So I am trying to understand the wildcard regex with no luck

Need to turn

f_firstname
f_lastname
f_dob       
f_origincountry 
f_landing  

Into

':f_firstname'=>$f_firstname,
':f_lastname'=>$f_lastname,
':f_dob'=>$f_dob,
':f_origincountry'=>$f_origincountry,   
':f_landing'=>$f_landing,

In the answer can you please briefly describe the regex you are using, I have been reading the tutorials but they boggle my mind. Thanks.

  • 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-06-11T07:10:43+00:00Added an answer on June 11, 2026 at 7:10 am

    Edit: As Chris points out, you can improve the regex by cleaning up any white space there may be in the target string. I also replace the dot with \w as he did because it’s better practice than using the .

    Search: ^f_(\w+)\s*$
    ^     # start at the beginning of the line
    f_    # look for f_
    (\w+) # capture in a group all characters
    \s*   # optionally skip over (don't capture) optional whitespace
    $     # end of the line
    
    Replace: ':f_\1'=>$f_\1,
    ':f_    # beginning of replacement string
    \1      # the group of characters captured above
    '=>$f_  # some more characters for the replace
    \1,     # the capture group (again)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to create a regular expressions pattern that matches any reference
I've been struggling with this all day, as regular expressions aren’t my most favourite
First of all I'm a toddler when it comes to regular expressions. I need
I'm new to Regular Expressions and things like that. I have only few knowledge
First of all, let me please clarify that I know absolutely nothing about regular
First of all, I'm quite new to the Android and JAVA world (coming from
First of all, apologize because I have seen some posts about this, but I
First of all, let me say that I am not a professional coder -
It's been several years since I have used regular expressions, and I was hoping
I've spent most of the day learning about regular expressions in an attempt to

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.