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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:35:56+00:00 2026-05-26T15:35:56+00:00

I got about 2000 sentences about fatalities and i would like to filter them

  • 0

I got about 2000 sentences about fatalities and i would like to filter them on cause.
To begin i want to start with these:

______ fell (*) ______ 

to the
off the
from the 

where ______ is a group of 1 word, and (*) is to the, off the or from the

I tried

(\w*)fell+\s+to\sthe|off\sthe|from\sthe(\w*)

it returns the “off the” etc but it doesn’t look if the word fell was there.
(the groups probably don’t work neither then.)

So what is wrong, I do use fell+ so fell should be there 1 time right?

  • 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-26T15:35:57+00:00Added an answer on May 26, 2026 at 3:35 pm

    I would go with (\\w*)fell\\s[to|off|from\\sthe]\\s*(\\w*)

    Here’s a little example:

    import java.util.regex.*;
    class rtest { 
        static String regex = "(\\w*)fell\\s[to|off|from\\sthe]\\s*(\\w*)";
        static Pattern pattern = Pattern.compile(regex);
    
        public static void main(String[] args) {
            process("Bob fell off the bike");
            process("Matt fell to the bottom");
            process("I think Terry fell from the beat of a different drum");
        }
        static void process(String text) {
            System.out.println(text);
            String[] tokens = text.split(regex);
            for(String t : tokens) System.out.println(t);
            System.out.println(" ");
        }
    }
    

    Results in:

    C:\Documents and Settings\glowcoder\My Documents>javac rtest.java
    
    C:\Documents and Settings\glowcoder\My Documents>java rtest
    Bob fell off the bike
    Bob
     the bike
    
    Matt fell to the bottom
    Matt
     the bottom
    
    I think Terry fell from the beat of a different drum
    I think Terry
     the beat of a different drum
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got about 25 tables that I'd like to update with random data that's
I've got about 2500 short phrases in a file. I want to be able
I've got about three years c# experience. I'd like to learn some WPF and
I have a table with about 1000 records and 2000 columns. What I want
For a main menu I've got about 3 header catagoty's I like to static
How would I got about decoding the string below from basE91 to readable text
how would i got about doing something when hovering over a list item, but
I've got about 400 different NSString entries in my plist file. I want to
I have got a list containing nested lists like this : [ [datetime.datetime(2000, 12,
I've got about 20 on/off switches that sends an ajax request which updates 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.