Does anybody know of a way, or something that could ease the process of manually removing the extra strings, to get only the content of the "Text" column in the logcat view when copying the logcat content?
Seems not possible, but I've drawn an attention to it through android issues portal:
https://code.google.com/p/android/issues/detail?id=77883&thanks=77883&ts=1413891569
Hopefully it will be implemented soon enough, as it woudl be really helpful.
There are two ways to achieve that:
The First Way, if you have multiple lines:
copy your text to Notepad++ or any editor that uses Regex.
press ctrl+f and choose Replace tab.
use a Regex format in order to remove all the unnecessary tags info, for example in the case of System.out messages, the Regex formula will be:
\d*-\d* \d*:\d*:\d*\.\d*: I\/System\.out\(\d*\):
if the messages are like:
03-14 14:44:17.557: I/System.out(18293):
finaly, use this formula in [find what] field and use a white space in the [Replace with] field, and don't forget to choose Regular Expression choice in the (search mode) field.
The second way, if you have a single line of log: as described here:
Right click on the line in Logcat which you wish to copy text from
Click “find similar messages”
In the window that pops up the text is contained in the field “by Log Message:”
This text can now be copied via Ctrl+C
Related
I've been stuck on a problem where I have a json object with a value in it titled message, which will have lots of string and some will even contain links in the format below (like how this site has different formats for their bold, italics, etc)
[[www.randomwebsite.com]] gives www.randomwebsite.com
or
[[www.randomwebsite.com random]] gives random
The regex that I have for the top one is:
\[\[.[^\]]*\]\]
and I'm doing a .replaceAll to try and add the href tags to it, but it isn't working as I feel I've done it wrong. My code for that is
String htmlHyperlinkMessage = htmlStrikeMessage.replaceAll(Constants.HYPERLINK_REGEX, "$1");
but this gives me an array out of bounds exception and I'm just stuck on this, can anyone give any suggestions?
It's greatly appreciated, I have looked around on the forum but I couldn't find anything related to my example as the format for different hyperlinks has confused me.
EDIT
Here's my stacktrace logcat
java.lang.ArrayIndexOutOfBoundsException: length=2; index=2
at java.util.regex.Matcher.group(Matcher.java:579)
at java.util.regex.Matcher.appendEvaluated(Matcher.java:138)
at java.util.regex.Matcher.appendReplacement(Matcher.java:111)
at java.util.regex.Matcher.replaceAll(Matcher.java:319)
at java.lang.String.replaceAll(String.java:1600)
at com.myapp.android.model.PostItem.getMessage(PostItem.java:98)
When you're replacing something with a group (like $1, $2), you need to capture that group using parentheses. You're getting an out-of-bounds exception because $1 tries to find a group you made, but your regex \[\[.[^\]]*\]\] contains no groups.
If you want to capture the contents of [[]] as a group, you can add parentheses: \[\[(.[^\]]*)\]\]
For a further explanation, read the "3.4. Grouping and back reference" part of this article: http://www.vogella.com/tutorials/JavaRegularExpressions/article.html
And the replacement "$1" doesn't seem right either. It should be something like "$1"
By the way, I don't think the . character in your regex is needed. It does make sure the square brackets aren't empty, but you can achieve the same effect more clearly by replacing the * with + like this:
\[\[([^\]]+)\]\]
I know I can use regular expressions in DDMS window but can't figure out how. Suppose, I have filter 1 filtering by log label "A" and filter 2 filtering by log label "B" so what do I print in the ddms edit panel so I have both outputs from "A" and from "B" and nothing else?
You can use regular expressions inside the log panel,let's say you want to filter by tag,you write inside the tag filter:
^com.test.TestClassA$|^com.test.TestClassB$
It accepts simple boolean logic too,so even something along these lines would work:
com.test.TestClassA|com.test.TestClassB
No spaces between OR bars.
You can even do it directly from logcat top window,by appending a prefix for your desired scope:
tag:com.test.TestClassA|com.test.TestClassB
or the regex
tag:^com.test.TestClassA$|^com.test.TestClassB$
hope this is useful for you.
Try with the regular expression:
^TAG_A$|^TAG_B$
can any one know about how to add/insert emotions/smiles to text(which ever i typed in my edit text for my notes). i have little confusion about if i want to add these smiles of type .png in to edit text type of string, is it possible? and also i have to save these input into sqlite database. normally i know to store string data taken from edit text.
but along with that text i want to also add smiles symbols where ever my cursor placed and to be store in sqlite data base. and get it back to read.
so guys any ideas, most welcome!
Try to use java (i.e. android) spannable method to implement smiley (i.e.) images for that. You will surely get it, search in google for "how to add images/smiley with java spannable method in android?" you will get good idea.
Reading your question the first thing I can think of is Mapping each image to a sequence of letters, for example :) is smiley.png etc. Now your database also has these smaller representation However while reading from the database you can convert those special character sequences to appropriate image.
For simplicity in seraching those Strings You can wrap them in some less used characters i.e. [ or { or <.
I've just imported a chunk of text into a string element for a book app and I'm getting this error : An invalid XML character (Unicode:0x1f) was found in the element content of this document.
I looked it up here http://lwp.interglacial.com/appf_01.htm and the description says US (removing underlining doesnt seem to work).
What is this character so I can remove it if possible.
I'm very new to android so simple answers please :)
0x1f is a Unit Separator, an archaic way to separate fields in a text (Like , or Tab in CSV).
It is indeed not a valid text character in XML 1.0 (but allowed in XML 1.1). In a UTF-8 input string, you can also safely replace the byte 0x1f with 0x09(Tab) to work around the problem. Alternatively, declare the document as XML 1.1 and use an XML 1.1 parser.
US means "Unit separator". This is an invisible character, so you should open your text file with some text editor that can show the invisible characters and remove them. I think that probably Notepad++ will give you this functionality:
http://notepad-plus-plus.org/
Use Nodepad++ you will find the "Unit separator".
Like the picture:
There is a TextField "Filter" below the LogCat output. However, it seems to filter only the Message-column. Id like to filter Tags also. Because there are my class names.
How can I achieve it?
There's a button that looks like a green + in the upper right of the log cat window, if you mouse over it says "Create Filter" in the popup from that you can filter by log tag. It creates a new tab in log cat with the filter name you specified. Then all of the output of that tag will go to that tab and not the "Log" tab.
In Eclipse, if I would like to exclude those annoying Choreographer messages,I write this filter in the logcat filter TextField : tag:^(?!Choreographer).*$ and it excludes all messages which tag starts with the text Choreographer
If you want multiple exclusions : tag:^(?!Choreographer|dalvikvm-heap|Trace).*$
The Log tag field accepts Java regular expressions, so try this:
^TAG_A$|^TAG_B$
which matches exactly those tags. You can go crazy with complicated regular expressions, if that's your idea of fun.
Old question, but still relevant, and didn't see this answer among the answers here.
To filter by multiple columns in logcat textfield, simply use a space between regular expressions, and the column title in lower case followed by : to assign the regex to that column instead of the default "text:"
for example:
tag:wif text:event
a space '' is used as an AND argument.
a single '|' without space is an OR.
Regarding one of the comments I've seen here - There is no realy need for a wildcard, since it is automatically applied before and after the filter text.
If you don't want wildcard, you can use regular expression syntax to restrict the string.
for example: ^starswith or fullword$
TIP: if you want to match a space character or a tab in your output, just type in: \s at the desired place.
A sample from the ADB manual:
adb logcat ActivityManager:I MyApp:D *:S
The *:S is vital as this would suppress other tags different than the ones specified by us.
Unfortunately, one can't use wildcards in the names, i.e.:
adb logcat ActivityManager:I MyApp*:D *:S
wouldn't work.
When filtering, you must use no whitespace after 'tag:' and all is case sensitive. For example:
tag:MIRKO
and not
TAG: mirko
Run logcat in a shell and pipe it through grep.
There's probably even a way to do execute this from an eclipse window that would capture the output.
this should be the same across all platforms, but I'm specifically doing this on Mac Snow leopard, helios....
with the latest eclipse and android plugin, go to window -> show view -> android -> logcat
then in the upper right corner of the view there are filter buttons : "V" "D" "I" "W" "E" then a + edit and -
click on the + and type in your tag, or pid
enjoy filtered logCat
In LogCat's search textbox, you will see the hint text "Search for messages, Accepts Java regexes, Prefix with pid:, app:, tag: or text: to limit scope."
So just type in tag:YOUR_TAG_NAME