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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:31:34+00:00 2026-05-16T06:31:34+00:00

Ok now I think Im getting warmer, I have to pattern match whatever comes

  • 0

Ok now I think Im getting warmer, I have to pattern match whatever comes in.

So if I had say

Message = = [[<<>>], 
 [<<"10">>,<<"171">>],
 [<<"112">>,<<"Gen20267">>],
 [<<"52">>,<<"20100812-06:32:30.687">>]] 

And I was looking to pattern match the field <<“112″>>

Such as the 112 is always going to say 112, but the Gen2067 can change whenever to whatever.. its the data, it will be stored in a variable.

Also the fields can be in any order, whatever function im trying to do has to be able to find the field and parse it.

This is the code I am using right now:

loop() ->
receive
    [_,[<<"112">>, Data], _] when is_list(X) -> %% Just dosen't work in anyway..
        ?DEBUG("Got a list ~p~n", [X]),
        loop();
    _Other ->
        ?DEBUG("I don't understand ~p~n", [_Other]),
        loop()
end.

I feel im close, but not 100%

-B

  • 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-16T06:31:35+00:00Added an answer on May 16, 2026 at 6:31 am

    You can extract your data this way:

    1> Message = [[<<>>],                        
    1>  [<<"10">>,<<"171">>],                    
    1>  [<<"112">>,<<"Gen20267">>],              
    1>  [<<"52">>,<<"20100812-06:32:30.687">>]] .
    [[<<>>],
     [<<"10">>,<<"171">>],
     [<<"112">>,<<"Gen20267">>],
     [<<"52">>,<<"20100812-06:32:30.687">>]]
    2> [Data] = [X || [<<"112">>, X] <- Message ].
    [<<"Gen20267">>]
    3> Data.
    <<"Gen20267">>
    

    Another way:

    4> [_, Data] = hd(lists:dropwhile(fun([<<"112">>|_]) -> false; (_)->true end, Message)).
    [<<"112">>,<<"Gen20267">>]
    5> Data.
    <<"Gen20267">>
    

    And another one as function in module (probably fastest):

    % take_data(Message) -> Data | not_found
    take_data([]) -> not_found;
    take_data([[<<"112">>, Data]|_]) -> Data;
    take_data([_|T]) -> take_data(T).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear all,Now i have this question in my java program,I think it should be
I am updating this post with what I think I now know about getting
Ok now I am confused. I have been getting advice from SO users on
I was just think that now it is common to have enough RAM on
I have been battling this issue for a few days now and think I
I really have tried researching this problem, but I'm now getting so close to
UPDATE2: I think I got it now: <?php /* * @name Lawler's algorithm PHP
I think I'm going a little crazy. Right now, I'm working with the following
I'm using guidelines right now, but I do not think there is any way
Well, i've walking around this for a couples of days now... I think is

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.