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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:37:29+00:00 2026-06-17T23:37:29+00:00

I have input stream with the following data: ——————————————— manil@manil-ubvm:~$ db2level DB21085I Instance manil

  • 0

I have input stream with the following data:

---------------------------------------------
manil@manil-ubvm:~$ db2level
DB21085I  Instance "manil" uses "64" bits and DB2 code release "SQL10010" with 
level identifier "0201010E".
Informational tokens are "DB2 v10.1.0.0", "s120403", "LINUXAMD64101", and Fix 
Pack "0".
Product is installed at "/home/manil/sqllib".
---------------------------------------------

From above i need v10.1.0.0 to be stored in a string variable.

How to do that using java regular expression?

  • 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-17T23:37:31+00:00Added an answer on June 17, 2026 at 11:37 pm

    Use something like this to capture the version pattern :

    import java.util.regex.*;
    
        public class RTest {
    
                public static void main(String [] args) {
                        String raw_data = "asdkgjasdbf984 sdkjfashfiu 4qwsadkfjnv w98sa-asdf08gywbfsd v1231.123.12.11.1 fkjsdfn9823isd";
                        Pattern version_find = Pattern.compile("v[\\d+\\.?]+");
                        Pattern directory_find = Pattern.compile("[\\/[^\\/]+]+");
                        Matcher version_finder = version_find.matcher(raw_data);
                        while(version_finder.find()) {
                              System.out.println(version_finder.group());
                        }
                }
        }
    

    Output is :

    v1231.123.12.11.1
    /isd/asdasd2903 ajshdaq09r34/adsj 38/
    

    You really need to understand regexes deeply if you are a programmer. They are one of the essentials. They are hard at first, but once you ‘crack them’ you don’t forget it. Like riding a bike.

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

Sidebar

Related Questions

I have an input stream with the following lines: # <int> <int> <some_data_type> <some_data_type>
I have the following data as input (sorted by first column): foo 1 2
I have the following piece of code in a try/catch block InputStream inputstream =
I have an input stream, and I want to map to output lines. For
I have been testing the performance of reading server socket input stream. I found
So a FILE stream can have both input and output buffers. You can adjust
I have this form: <form action=image_upload.php method=post enctype=multipart/form-data> Image 1: <input type=file name=event_image />
Please have a look at the following code. I am using JExcel API import
I have a large amount of input data that I want to compress to
In Java I have the following while(true) { input = clientSocket.getInputStream(); byte[] bytes =

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.