How to filter out a portion of the text data with re.match or any other regex method with Python? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Moderator Election Q&A - Questionnaire 2019 Community Moderator Election ResultsDealing with diverse text datahow to get the Polysemes of a word in wordnet or any other api?Python: validating the existence of NLTK data with database searchHow to programmatically suggest changes to a text to match some other text?How to use Non Negative Matric Factorization (NMF)'s transform method to project topics on new text dataAny research on segmentation of non-text contents out of (mostly) text-documents?Are there any good out-of-the-box language models for python?any efficient way to find surrounding adjective/verbs with respect to the target phrase in python [updated]?How to generate list with out for loop in pythonText Mining/Printing with Python
Is it true that "carbohydrates are of no use for the basal metabolic need"?
Echoing a tail command produces unexpected output?
LaTeX gives error undefined control sequence table
I am not a queen, who am I?
Why is black pepper both grey and black?
Is there any avatar supposed to be born between the death of Krishna and the birth of Kalki?
Can a non-EU citizen traveling with me come with me through the EU passport line?
How do I stop a creek from eroding my steep embankment?
How to deal with a team lead who never gives me credit?
Do I really need recursive chmod to restrict access to a folder?
How can I fade player character when he goes inside or outside of the area?
Problem drawing boxes with arrows in tikZ
What do you call a plan that's an alternative plan in case your initial plan fails?
How to do this path/lattice with tikz
Why constant symbols in a language?
Antler Helmet: Can it work?
Were Kohanim forbidden from serving in King David's army?
Storing hydrofluoric acid before the invention of plastics
What are the possible ways to detect skin while classifying diseases?
Why was the term "discrete" used in discrete logarithm?
Dating a Former Employee
When to stop saving and start investing?
Is there a concise way to say "all of the X, one of each"?
Is the address of a local variable a constexpr?
How to filter out a portion of the text data with re.match or any other regex method with Python?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Moderator Election Q&A - Questionnaire
2019 Community Moderator Election ResultsDealing with diverse text datahow to get the Polysemes of a word in wordnet or any other api?Python: validating the existence of NLTK data with database searchHow to programmatically suggest changes to a text to match some other text?How to use Non Negative Matric Factorization (NMF)'s transform method to project topics on new text dataAny research on segmentation of non-text contents out of (mostly) text-documents?Are there any good out-of-the-box language models for python?any efficient way to find surrounding adjective/verbs with respect to the target phrase in python [updated]?How to generate list with out for loop in pythonText Mining/Printing with Python
$begingroup$
I have the following data :
Node : WATER-7609-WR1
IP Address : 172.20.150.81
Severity : 5 - Critical
ServerSerial : 50505223
SNSupportGroup : UC-WAN
Node Location : CO 160 WATER 8 FL RCV
Event Details : Unknown Not Link Down or Up trap on Serial Channel: Unknown Severity: 4
NOTE:Configuration Item is not found in CMDB. Please update Incident with related Configuration Item
I am interested in all text after "Event Details :",
I have used the the following function :
def eventdetails(text):
match =re.search(r'Event Details :[^.]*',text)
return match
print(eventdetails(dfnetcool_inc["Description"][3]))
output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap >
--> Am not getting all of the text after Event Details. Perhaps there is an EOL charecter - how do I get remainder of the text, request your help, TIA!
python nlp regex
$endgroup$
add a comment |
$begingroup$
I have the following data :
Node : WATER-7609-WR1
IP Address : 172.20.150.81
Severity : 5 - Critical
ServerSerial : 50505223
SNSupportGroup : UC-WAN
Node Location : CO 160 WATER 8 FL RCV
Event Details : Unknown Not Link Down or Up trap on Serial Channel: Unknown Severity: 4
NOTE:Configuration Item is not found in CMDB. Please update Incident with related Configuration Item
I am interested in all text after "Event Details :",
I have used the the following function :
def eventdetails(text):
match =re.search(r'Event Details :[^.]*',text)
return match
print(eventdetails(dfnetcool_inc["Description"][3]))
output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap >
--> Am not getting all of the text after Event Details. Perhaps there is an EOL charecter - how do I get remainder of the text, request your help, TIA!
python nlp regex
$endgroup$
$begingroup$
Could you help us by indicating which part of the message you are interested in?
$endgroup$
– El Burro
Apr 1 at 14:46
$begingroup$
I am interested in all text after "Event Details :", I have used the the following function : def eventdetails(text): match =re.search(r'Event Details :[^.]*',text) return match print(eventdetails(dfnetcool_inc["Description"][3])) output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap > --> Am not getting all of the text.
$endgroup$
– Vivek Rmk
Apr 1 at 15:54
$begingroup$
solved : I used - match =re.findall(r'Event Details :[^*]+',flags= re.M, string= text)
$endgroup$
– Vivek Rmk
Apr 1 at 21:07
add a comment |
$begingroup$
I have the following data :
Node : WATER-7609-WR1
IP Address : 172.20.150.81
Severity : 5 - Critical
ServerSerial : 50505223
SNSupportGroup : UC-WAN
Node Location : CO 160 WATER 8 FL RCV
Event Details : Unknown Not Link Down or Up trap on Serial Channel: Unknown Severity: 4
NOTE:Configuration Item is not found in CMDB. Please update Incident with related Configuration Item
I am interested in all text after "Event Details :",
I have used the the following function :
def eventdetails(text):
match =re.search(r'Event Details :[^.]*',text)
return match
print(eventdetails(dfnetcool_inc["Description"][3]))
output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap >
--> Am not getting all of the text after Event Details. Perhaps there is an EOL charecter - how do I get remainder of the text, request your help, TIA!
python nlp regex
$endgroup$
I have the following data :
Node : WATER-7609-WR1
IP Address : 172.20.150.81
Severity : 5 - Critical
ServerSerial : 50505223
SNSupportGroup : UC-WAN
Node Location : CO 160 WATER 8 FL RCV
Event Details : Unknown Not Link Down or Up trap on Serial Channel: Unknown Severity: 4
NOTE:Configuration Item is not found in CMDB. Please update Incident with related Configuration Item
I am interested in all text after "Event Details :",
I have used the the following function :
def eventdetails(text):
match =re.search(r'Event Details :[^.]*',text)
return match
print(eventdetails(dfnetcool_inc["Description"][3]))
output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap >
--> Am not getting all of the text after Event Details. Perhaps there is an EOL charecter - how do I get remainder of the text, request your help, TIA!
python nlp regex
python nlp regex
edited Apr 1 at 19:14
oW_♦
3,341933
3,341933
asked Apr 1 at 13:55
Vivek RmkVivek Rmk
12
12
$begingroup$
Could you help us by indicating which part of the message you are interested in?
$endgroup$
– El Burro
Apr 1 at 14:46
$begingroup$
I am interested in all text after "Event Details :", I have used the the following function : def eventdetails(text): match =re.search(r'Event Details :[^.]*',text) return match print(eventdetails(dfnetcool_inc["Description"][3])) output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap > --> Am not getting all of the text.
$endgroup$
– Vivek Rmk
Apr 1 at 15:54
$begingroup$
solved : I used - match =re.findall(r'Event Details :[^*]+',flags= re.M, string= text)
$endgroup$
– Vivek Rmk
Apr 1 at 21:07
add a comment |
$begingroup$
Could you help us by indicating which part of the message you are interested in?
$endgroup$
– El Burro
Apr 1 at 14:46
$begingroup$
I am interested in all text after "Event Details :", I have used the the following function : def eventdetails(text): match =re.search(r'Event Details :[^.]*',text) return match print(eventdetails(dfnetcool_inc["Description"][3])) output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap > --> Am not getting all of the text.
$endgroup$
– Vivek Rmk
Apr 1 at 15:54
$begingroup$
solved : I used - match =re.findall(r'Event Details :[^*]+',flags= re.M, string= text)
$endgroup$
– Vivek Rmk
Apr 1 at 21:07
$begingroup$
Could you help us by indicating which part of the message you are interested in?
$endgroup$
– El Burro
Apr 1 at 14:46
$begingroup$
Could you help us by indicating which part of the message you are interested in?
$endgroup$
– El Burro
Apr 1 at 14:46
$begingroup$
I am interested in all text after "Event Details :", I have used the the following function : def eventdetails(text): match =re.search(r'Event Details :[^.]*',text) return match print(eventdetails(dfnetcool_inc["Description"][3])) output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap > --> Am not getting all of the text.
$endgroup$
– Vivek Rmk
Apr 1 at 15:54
$begingroup$
I am interested in all text after "Event Details :", I have used the the following function : def eventdetails(text): match =re.search(r'Event Details :[^.]*',text) return match print(eventdetails(dfnetcool_inc["Description"][3])) output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap > --> Am not getting all of the text.
$endgroup$
– Vivek Rmk
Apr 1 at 15:54
$begingroup$
solved : I used - match =re.findall(r'Event Details :[^*]+',flags= re.M, string= text)
$endgroup$
– Vivek Rmk
Apr 1 at 21:07
$begingroup$
solved : I used - match =re.findall(r'Event Details :[^*]+',flags= re.M, string= text)
$endgroup$
– Vivek Rmk
Apr 1 at 21:07
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
nice that you solved it. This would also work:
import re
def eventdetails(text):
match =re.search(r'Event Details :(.*)',text, flags=re.S)
return match
result = eventdetails(text)
print(result.group(0))
$endgroup$
$begingroup$
Yes that works too! Thanks!
$endgroup$
– Vivek Rmk
Apr 2 at 14:42
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48353%2fhow-to-filter-out-a-portion-of-the-text-data-with-re-match-or-any-other-regex-me%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
nice that you solved it. This would also work:
import re
def eventdetails(text):
match =re.search(r'Event Details :(.*)',text, flags=re.S)
return match
result = eventdetails(text)
print(result.group(0))
$endgroup$
$begingroup$
Yes that works too! Thanks!
$endgroup$
– Vivek Rmk
Apr 2 at 14:42
add a comment |
$begingroup$
nice that you solved it. This would also work:
import re
def eventdetails(text):
match =re.search(r'Event Details :(.*)',text, flags=re.S)
return match
result = eventdetails(text)
print(result.group(0))
$endgroup$
$begingroup$
Yes that works too! Thanks!
$endgroup$
– Vivek Rmk
Apr 2 at 14:42
add a comment |
$begingroup$
nice that you solved it. This would also work:
import re
def eventdetails(text):
match =re.search(r'Event Details :(.*)',text, flags=re.S)
return match
result = eventdetails(text)
print(result.group(0))
$endgroup$
nice that you solved it. This would also work:
import re
def eventdetails(text):
match =re.search(r'Event Details :(.*)',text, flags=re.S)
return match
result = eventdetails(text)
print(result.group(0))
answered Apr 2 at 8:23
El BurroEl Burro
455311
455311
$begingroup$
Yes that works too! Thanks!
$endgroup$
– Vivek Rmk
Apr 2 at 14:42
add a comment |
$begingroup$
Yes that works too! Thanks!
$endgroup$
– Vivek Rmk
Apr 2 at 14:42
$begingroup$
Yes that works too! Thanks!
$endgroup$
– Vivek Rmk
Apr 2 at 14:42
$begingroup$
Yes that works too! Thanks!
$endgroup$
– Vivek Rmk
Apr 2 at 14:42
add a comment |
Thanks for contributing an answer to Data Science Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48353%2fhow-to-filter-out-a-portion-of-the-text-data-with-re-match-or-any-other-regex-me%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Could you help us by indicating which part of the message you are interested in?
$endgroup$
– El Burro
Apr 1 at 14:46
$begingroup$
I am interested in all text after "Event Details :", I have used the the following function : def eventdetails(text): match =re.search(r'Event Details :[^.]*',text) return match print(eventdetails(dfnetcool_inc["Description"][3])) output: <_sre.SRE_Match object; span=(159, 292), match='Event Details : Unknown Not Link Down or Up trap > --> Am not getting all of the text.
$endgroup$
– Vivek Rmk
Apr 1 at 15:54
$begingroup$
solved : I used - match =re.findall(r'Event Details :[^*]+',flags= re.M, string= text)
$endgroup$
– Vivek Rmk
Apr 1 at 21:07