| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Regular expression helpers.""" | 5 """Regular expression helpers.""" |
| 6 | 6 |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 | 9 |
| 10 def _CreateIdentifierRegex(parts): | 10 def _CreateIdentifierRegex(parts): |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 To match part of a name, use {{_some_name_}}. This will additionally match: | 50 To match part of a name, use {{_some_name_}}. This will additionally match: |
| 51 kPrefixSomeNameSuffix, PREFIX_SOME_NAME_SUFFIX, etc. | 51 kPrefixSomeNameSuffix, PREFIX_SOME_NAME_SUFFIX, etc. |
| 52 | 52 |
| 53 Note: SymbolGroup.Where* methods call this function already, so there is | 53 Note: SymbolGroup.Where* methods call this function already, so there is |
| 54 generally no need to call it directly. | 54 generally no need to call it directly. |
| 55 """ | 55 """ |
| 56 return re.sub(r'\{\{(.*?)\}\}', | 56 return re.sub(r'\{\{(.*?)\}\}', |
| 57 lambda m: _CreateIdentifierRegex(m.group(1).split('_')), | 57 lambda m: _CreateIdentifierRegex(m.group(1).split('_')), |
| 58 pattern) | 58 pattern) |
| OLD | NEW |