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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:57:49+00:00 2026-05-30T20:57:49+00:00

I have files with the words written on different speaking languages. I would like

  • 0

I have files with the words written on different speaking languages. I would like to parse them using python programming language to have the same structure in all files.
Currently files contain the lines like

1. word1
24. word2
- word3
word4
** word5

The goal is to have all of them written like

** word

I have already some code reading from one file, fr, and writing to new one, fw, like this

    for line in fr:
        match = re.search(r'^\*\* .*', line)
        if match:
        fw.write(line)

I have two questions.

First question. How to write regexp, so it will be searching for line starting not from alpha character and remove everything that is before alpha character?

I have tried like this

fw.write(re.sub(r'(^([^a-zA-Z].*)([a-zA-Z])*.*)', "** \1", line))

but it doesn’t work.

Second question. How to verify if the string starts with alpha character. I have tried

print line[0].isalpha()

it returns ?. Do I need to have it unicode first?

Thank you.

  • 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-30T20:57:50+00:00Added an answer on May 30, 2026 at 8:57 pm

    Try matching any of the possible line prefixes, then collect the rest of the line as your word of interest.

    pat = re.compile(r'^(\d+\. |- |\*\* )?(?P<word>.*)')
    

    The first group defines the possible prefixes (you might want to fix it up for one or more spaces instead of a literal space). The second, named, group gets the word.

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

Sidebar

Related Questions

I'm developing a python framework that would have addons written as separate packages. I.e.:
I have two files which both contain a list of words. Is there an
I have a text file containing words separated by newline , like the following
If I have a a textfile say file.txt and it contains random words like:
I have the code below which I am using to upload files to my
I have code that manipulates binary files using fstream with the binary flag set
I have written a little program that parses log files of anywhere between a
I have written a C# Windows Forms application to merge the files and folders
I have written an application for BlackBerry devices that stores some files in the
So I have a web app written in PHP that will run on 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.