Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r7783 r7786 204 204 // Format 205 205 // tag1\tval1\ntag2\tval2\n 206 tags = readTagsByRegexp(buf, "[\\r\\n]+", " ([a-zA-Z0-9:_]+)\\t(.*?)", false);206 tags = readTagsByRegexp(buf, "[\\r\\n]+", ".*([a-zA-Z0-9:_]+).*\\t(.*?)", false); 207 207 // try "tag\tvalue\n" format 208 208 if (tags!=null) return tags; … … 213 213 // a = "b=c" is OK 214 214 // a = b=c - this method of parsing fails intentionally 215 tags = readTagsByRegexp(buf, "[\\n\\t\\r]+", "( [a-zA-Z0-9:_]+)=(.*?)", true);215 tags = readTagsByRegexp(buf, "[\\n\\t\\r]+", "(.*?)=(.*?)", true); 216 216 // try format t1=v1\n t2=v2\n ... 217 217 if (tags!=null) return tags; -
trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java
r7081 r7786 39 39 @Test 40 40 public void testTNformat() { 41 String txt = " a \t 1 \n\n\n b =2\t the value with \"quotes\"";41 String txt = " a \t 1 \n\n\n b\t2 \n c \t the value with \"quotes\""; 42 42 Map<String, String> correctTags = new HashMap<String, String>() { { 43 put("a", "1"); put("b =2", "the value with \"quotes\"");43 put("a", "1"); put("b", "2"); put("c", "the value with \"quotes\""); 44 44 }}; 45 45 Map<String, String> tags = TextTagParser.readTagsFromText(txt);
Note:
See TracChangeset
for help on using the changeset viewer.